public abstract class Car
{
    private String model;
    public abstract void color();
    public String getName()
    {
        return model;
     }
     public void setName(String carModel)
     {
        model = carModel;
      }
}
?
?
Using the code above, would it be possible to create a class in which you declare a Car object with the statement Car myCar = new Car("Honda");?
Explain why or why not.

What will be an ideal response?


The Car class in this example is declared as abstract. You cannot create a class in which you declare a Car object with a statement such as Car myCar = new Car("Honda"); because a class that attempts to instantiate a Car object does not compile. Car is an abstract class, so no Car objects can exist. You create an abstract class such as Car only so you can extend it.

Computer Science & Information Technology

You might also like to view...

A(n) ________ is 8 bits

A) algorithm B) hertz C) byte D) nancosecond

Computer Science & Information Technology

Customizing the Notes and Handouts ________ allows you to add information that will be included on all Notes and Handouts pages

Fill in the blank(s) with correct word

Computer Science & Information Technology

Directing conventional weapons against a computer facility is an example of a physical attack

Indicate whether the statement is true or false.

Computer Science & Information Technology

To delete a hyperlink, right-click it, then click ____________________ Hyperlink.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology