Examlex
What is printed by the following code? Consider the polymorphic invocation.
public class Inherit
{
class Figure
{
void display( )
{
System.out.println("Figure") ;
}
}
class Rectangle extends Figure
{
void display( )
{
System.out.println("Rectangle") ;
}
}
class Box extends Figure
{
void display( )
{
System.out.println("Box") ;
}
}
Inherit( )
{
Figure f = new Figure( ) ;
Rectangle r = new Rectangle( ) ;
Box b = new Box( ) ;
f.display( ) ;
f = r;
f.display( ) ;
f = b;
f.display( ) ;
}
public static void main(String[ ] args)
{
new Inherit( ) ;
}
}
Q13: The term ethnicity was originally proposed in
Q13: The Abstract Data Type (ADT) is thought
Q21: Charles Darwin<br>A) grew up in modest circumstances<br>B)
Q26: Who coined the term "biology"?<br>A) Jean-Baptiste Lamarck<br>B)
Q33: Demonstrate how the following array is sorted
Q34: Java methods can return more than one
Q39: Discuss the definition of fitness as it
Q40: What is meant by the statement, "natural
Q46: Write a statement using a Scanner method
Q47: Francis Galton, Darwin's cousin, originated the eugenics