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:
Verified
Q63: A class that cannot be instantiated is
Q64: Consider the Counter class below. public class
Q65: Consider the following code snippet: Vehicle aVehicle
Q66: Consider the following code snippet: Employee anEmployee
Q66: If a class has an abstract method,
Q68: Suppose the abstract class Message is defined
Q69: Consider the following code snippet: Vehicle aVehicle
Q71: A class from which you cannot create
Q72: Consider the following code snippet: Employee anEmployee
Q79: Which of the following statements about classes
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