Regarding the Java language answer the following true or false questions. All ob
ID: 3673758 • Letter: R
Question
Regarding the Java language answer the following true or false questions.
All objects inherit the methods from the Object class.
In a child class, you can directly access private instance variables declared in the parent class.
In a child class, you can directly invoke private methods declared in the parent class.
Which of the following is the syntax to invoke the parent's constructor?
In a child class constructor, if you do not explicitly call a parent constructor, then no parent constructor is ever called.
Explanation / Answer
1. The main base class is called object class. This object class is the parent class of all the classes in java bydefault. if you want to refer any object whose type you don't know then we go for Object class. So thats the reason directly or indirectly all classes and objects in the class will inherit the properties from object class.
2. We can only call a private member method in its definition class. So we cant inherit the priate varibles directly.
3.The same with this question If a method is given private it is to be that it should remain with that only particular class. So we cant invoke private members declared in private class in the given chind class..
4, we use super key word to invoke parents constructors.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.