Solved

Consider the Classes Shown Below: Public Class Parent

Question 11

Multiple Choice

Consider the classes shown below: public class Parent
{
Private int value = 100;
Public int getValue()
{
Return value;
}
}
Public class Child extends Parent
{
Private int value;
Public Child(int number)
{
Value = number;
}
}
What is the output of the following lines of code?
Child kid = new Child(-14) ;
Parent kid2 = new Child(21) ;
System.out.println(kid.getValue() + " "
+ kid2.getValue() ) ;


A) 100 100
B) -14 21
C) 21 21
D) -14 100

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents