Exam 11: Advanced Inheritance Concepts
Exam 1: Creating Your First Java Classes76 Questions
Exam 2: Using Data81 Questions
Exam 3: Using Methods, Classes and Objects79 Questions
Exam 4: More Object Concepts84 Questions
Exam 5: Making Decisions80 Questions
Exam 6: Looping77 Questions
Exam 7: Characters, Strings and the Stringbuilder82 Questions
Exam 8: Arrays77 Questions
Exam 9: Advanced Array Concepts80 Questions
Exam 10: Introduction to Inheritance78 Questions
Exam 11: Advanced Inheritance Concepts78 Questions
Exam 12: Exception Handling79 Questions
Exam 13: File Input and Output78 Questions
Exam 14: Introduction to Swing Components79 Questions
Exam 15: Using Javafx and Scene Builder65 Questions
Select questions type
When you create a class that uses an interface, you include the keyword extends .
(True/False)
5.0/5
(34)
public class Animal
{
}
public class Animal extends Object
{
}
The two class declarations above have identical outcomes. Explains why this is the case.
(Essay)
4.9/5
(37)
While a class can inherit from multiple abstract superclasses, it can implement only one interface.
(True/False)
4.8/5
(43)
If you provide an empty method within an abstract class, the method is an abstract method even if you do not explicitly use the keyword ____ when defining the method.
(Multiple Choice)
4.7/5
(39)
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.
(Essay)
4.9/5
(29)
____ compress the data they store, which reduces the size of archived class files.
(Multiple Choice)
4.9/5
(39)
Match each term with the correct statement below.
Premises:
A number that uniquely identifies an object
Responses:
lambda expression
nonabstract method
multiple inheritance
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(36)
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();
}
}
In the above code, the myHonda.getModel() and myHonda.color() method calls produce different output from when the same methods are used with myFord . Explain why this is the case.
(Essay)
4.9/5
(36)
Instead of using the automatic toString() method with your classes, it is usually more useful to write your own ____ version of the toString() method that displays some or all of the data field values for the object with which you use it.
(Multiple Choice)
4.8/5
(43)
Java does not allow a class to inherit directly from two or more parents.
(True/False)
4.8/5
(37)
Classes, such as the String class, have their own equals() methods that overload the ____ class method.
(Multiple Choice)
4.8/5
(39)
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.8/5
(36)
The equals() method returns a boolean value indicating whether two objects are equal. Using the above code, will the two BankAccount objects be equal? Explain why or why not.


(Essay)
4.9/5
(34)
The capability to inherit from more than one class is called ____.
(Multiple Choice)
4.8/5
(37)
The Object class ____ method converts an Object into a String that contains information about the Object .
(Multiple Choice)
4.9/5
(33)
Java's Object class contains a public method named ____ that returns an integer representing the hash code.
(Multiple Choice)
4.8/5
(30)
The java.lang package contains fundamental classes and is imported automatically each time a program is written.
(True/False)
4.9/5
(35)
When a superclass is abstract, you cannot instantiate objects of a superclass. How can you use a superclass abstract object?
(Essay)
4.7/5
(33)
Showing 21 - 40 of 78
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)