Solved

Public Abstract Class Car

Question 63

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.

Correct Answer:

verifed

Verified

When executed, the c...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents