Examlex

Solved

Public Abstract Class Car

question 41

Essay

public abstract class Car
{
    private String model;
    public abstract void color();
    public String getModel()
    {
         return model;
    }
    public void setModel(String modelName)
    {
         model = modelName;
    }
}
public class Honda extends Car
{
    public void color()
    {
       System.out.println("red");
    }
}
public class Ford extends Car
{
    public void color()
    {
      System.out.println("blue");
    }
}
public class MyCars
{
    public static void main(String[] args)
    {
       Honda myHonda = new Honda();
       Ford myFord = new Ford();
       myHonda.setModel("My Honda is ");
       myFord.setModel("My Ford is ");
       System.out.print(myHonda.getModel());
       myHonda.color();
       System.out.print(myFord.getModel());
       myFord.color();
    }
}
Using the above code, describe the output that will appear when the program is executed.


Definitions:

Accounting Period

A specific period of time used for financial reporting, often a quarter or year, during which financial information is recorded and reported.

Debit

An entry recorded on the left side of an account ledger, representing an increase in assets or expenses or a decrease in liabilities, equity, or revenue.

Credit

An accounting entry that increases a liability or equity account or decreases an asset or expense account.

Balance Sheet Accounts

Accounts that reflect the assets, liabilities, and shareholders' equity of a company at a particular point in time.

Related Questions