Examlex

Solved

What Is Printed? Public Class Inherit

question 6

Multiple Choice

What is printed?

public class Inherit
{

class Figure
{
void display( )
{
System.out.println("Figure") ;
}
}

class Rectangle extends Figure
{
void display( )
{
System.out.println("Rectangle") ;
}
}

class Box extends Rectangle
{
void display( )
{
System.out.println("Box") ;
}
}

Inherit( )
{
Figure f = new Figure( ) ;
Rectangle r = new Rectangle( ) ;
Box b = new Box( ) ;
f.display( ) ;
f = r;
((Figure) f) .display( ) ;
f = (Figure) b;
f.display( ) ;
}

public static void main(String[ ] args)
{
new Inherit( ) ;
}
}


Definitions:

Chorionic Villi Sampling

A prenatal test involving the sampling of chorionic villi from the placenta to detect genetic abnormalities.

Gestational Age

The age of an embryo or fetus calculated from the first day of the pregnant woman's last menstrual period.

Postmature

A term referring to a fetus or newborn that has gone beyond the typical gestation period, usually more than 42 weeks, which may pose risks for the child.

Premature

Occurring before the usual or expected time.

Related Questions