Solved

Consider the Classes Shown Below: Public Class Parent

Question 69

Multiple Choice

Consider the classes shown below: public class Parent
{
Public int getValue()
{
Return 24;
}
Public void display()
{
System.out.print(getValue() + " ") ;
}
}
Public class Child extends Parent
{
Public int getValue()
{
Return -7;
}
}
Using the classes above, what is the output of the following lines of code?
Parent kid = new Child() ;
Parent adult = new Parent() ;
Kid) display() ;
Adult.display() ;


A) -7 24
B) 24 24
C) -7 -7
D) 24 -7

Correct Answer:

verifed

Verified

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

Related Questions