Examlex

Solved

What Is Printed by the Following Code

question 69

Multiple Choice

What is printed by the following code?
public class Inherit
{

abstract class Speaker
{
abstract public void speak( ) ;
}
class Cat extends Speaker
{
public void speak( )
{
System.out.println("Woof!") ;
}
}

class Dog extends Speaker
{
public void speak( )
{
System.out.println("Meow!") ;
}
}

Inherit( )
{
Speaker d = new Dog( ) ;
Speaker c = new Cat( ) ;
d.speak( ) ;
c.speak( ) ;
}

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


Definitions:

Consumer Durables

Goods that are not consumed or destroyed in use and thus have a long life, such as appliances, cars, and furniture.

Recessionary Conditions

Economic circumstances characterized by a decline in GDP, income, employment, and trade, lasting for a period of time.

Servant Leadership

A leadership philosophy that focuses on serving the needs of others, prioritizing the well-being of team members and stakeholders over personal gain.

High Power Distance

Refers to cultures or organizations where there is a significant gap between those with power and those without, emphasizing hierarchy and authority.

Related Questions