Examlex

Solved

What Is Printed by the Following Code? Consider the Polymorphic

question 8

Multiple Choice

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( ) ;
}
}


Definitions:

Client-Centered Approach

A therapeutic method that focuses on the patient's self-perceived abilities, problems, and issues, emphasizing empathy and unconditional positive regard.

Dialectical Behavior Therapy

A form of cognitive-behavioral therapy aimed at teaching skills to manage emotional distress, improve interpersonal relationships, and live mindfully.

Borderline Personality Disorder

A mental health disorder marked by patterns of ongoing instability in moods, behavior, self-image, and functioning.

Eclectic or Multimodal Therapy

A therapeutic approach that combines techniques from various therapeutic modalities to tailor treatment to a client's individual needs.

Related Questions