What is printed?
public class Inherit
{
abstract class Figure
{
void display( )
{
System.out.println("Figure") ;
}
}
class Line extends Figure
{
void display( )
{
System.out.println("Line") ;
}
}
void tryme(Figure f)
{
f.display( ) ;
}
Inherit( )
{
Figure f = new Line( ) ;
tryme(f) ;
}
public static void main(String[ ] args)
{
new Inherit( ) ;
}
}
A) Line
B) Figure
C) Shape
D) Syntax error; the code won't even compile
E) none of the above
Correct Answer:
Verified
Q2: It is possible to sort an array
Q29: What is the efficiency of binary search?
A)
Q30: Considering the event processing classes, what is
Q32: What is printed by the following code?
public
Q33: Which of these methods will sort an
Q35: Although insertion sort and selection sort have
Q36: Which statement is completely True?
A) Java upcasts
Q37: What is printed?
public class Inherit
{
abstract class
Q38: What is printed?
public class Inherit
{
class Figure
{
void
Q39: What is printed?
public class Inherit
{
class Figure
{
void
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