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.
You might also like to view...
Match the following terms to their meanings:
I. Command that places a copy of the selected file on the Clipboard A. Paste II. Keyboard shortcut for copy B. Ctrl + V III. Holds one piece of information at a time C. Copy IV. Keyboard shortcut for paste D. Ctrl + C V. Command that inserts Clipboard copy somewhere else E. Clipboard
Themes are displayed in the Document Formatting group on the ________ tab
A) INSERT B) REVIEW C) DESIGN D) PAGE LAYOUT