Exam 11: Advanced Inheritance Concepts
Exam 1: Creating Java Programs68 Questions
Exam 2: Using Data74 Questions
Exam 3: Using Methods, Classes, and Objects68 Questions
Exam 4: More Object Concepts67 Questions
Exam 5: Making Decisions70 Questions
Exam 6: Looping72 Questions
Exam 7: Characters, Strings, and the Stringbuilder73 Questions
Exam 8: Arrays74 Questions
Exam 9: Advanced Array Concepts74 Questions
Exam 10: Introduction to Inheritance70 Questions
Exam 11: Advanced Inheritance Concepts70 Questions
Exam 12: Exception Handling65 Questions
Exam 13: File Input and Output74 Questions
Exam 14: Introduction to Swing Components74 Questions
Exam 15: Advanced Gui Topics69 Questions
Exam 16: Graphics74 Questions
Exam 17: Applets, Images, and Sound72 Questions
Select questions type
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.
(Essay)
4.7/5
(36)
When you create a new subclass in Java, neither the superclass source code nor the superclass _____ is changed.
(Multiple Choice)
4.8/5
(31)
The Object class equals() method returns a(n) ____ value indicating whether the objects are equal.
(Multiple Choice)
4.9/5
(48)
Java does not allow a class to inherit directly from two or more parents.
(True/False)
4.9/5
(39)
When you create a subclass of an abstract class, it's important to understand that you are required to code a subclass method to override the empty superclass method that is inherited.
(True/False)
5.0/5
(35)
When you create a number of classes that inherit from each other, as well as multiple interfaces that you want to implement with these classes, you often will find it convenient to place these related classes in a(n) ____________________.
(Short Answer)
4.9/5
(38)
Match each term with the correct statement below.
-A concrete class that extends the abstract class Calendar
(Multiple Choice)
4.8/5
(35)
Match each term with the correct statement below.
-The correct subclass method is attached to the application
(Multiple Choice)
4.7/5
(47)
Give an example of how you can create an interface to have a class implement behavior from more than one parent.
(Essay)
4.9/5
(34)
When you create a class that uses an interface, you include the keyword extends.
(True/False)
4.7/5
(34)
Match each term with the correct statement below.
-Considers two objects of the same class to be equal only if they have the same hash code
(Multiple Choice)
4.9/5
(36)
In the Java programming language, a package or class library is often delivered to users as a(n) ____________________ file.
(Short Answer)
4.9/5
(39)
A(n) ____ class is one from which you cannot create any concrete objects, but from which you can inherit.
(Multiple Choice)
4.9/5
(36)
When a class both extends and implements, by convention the ____ clause is last in the class header.
(Multiple Choice)
4.7/5
(39)
Match each term with the correct statement below.
-An alternative to multiple inheritance available in Java
(Multiple Choice)
4.8/5
(39)
A(n) ____ looks much like a class, except that all of its methods (if any) are implicitly public and abstract.
(Multiple Choice)
4.7/5
(47)
public interface FindTheError
{
void firstMethod(int anIntNum)
{
System.out.println("Did you find the error?");
}
}
What is the problem with the above interface? How would you correct the interface?
(Essay)
4.7/5
(35)
Showing 21 - 40 of 70
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)