Multiple Choice
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
Correct Answer:
Verified
Q1: A JSlider provides a list of String
Q3: Which of the following classes would you
Q4: Write a set of code to define
Q5: Assume that x is a GUI component
Q6: What is printed?<br><br> public class Inherit<br> { <br><br> class Figure<br> {<br> void
Q7: A class reference can refer to any
Q8: What is printed by the following code?
Q9: Binary search can be used on unsorted
Q11: Considering the event processing classes, what is
Q36: It is possible to sort an array