Consider the classes below,declared in the same file:
Class A
{
Int a;
Public A()
{
A = 7;
}
}
Class B extends A
{
Int b;
Public B()
{
B = 8;
}
}
Which of the statements below is false?
A) Both variables a and b are instance variables.
B) After the constructor for class B executes,the variable a will have the value 7.
C) After the constructor for class B executes,the variable b will have the value 8.
D) A reference of type A can be treated as a reference of type B.
Correct Answer:
Verified
Q4: When overriding a superclass method and calling
Q4: Superclass methods with this level of access
Q6: To avoid duplicating code,use _,rather than _.
A)inheritance,the
Q6: Using the protected keyword also gives a
Q8: Every class in Java, except _, extends
Q9: When a subclass constructor calls its superclass
Q12: Private fields of a superclass can be
Q13: Overriding a method differs from overloading a
Q16: Which of the following statements is false?
A)
Q20: Which of the following statements is false?
A)
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents