Recall & Review
beginner
What is an abstract method in Java?
An abstract method is a method declared without a body (no implementation) using the
abstract keyword. It must be implemented by subclasses.Click to reveal answer
beginner
Can you create an object of a class that contains an abstract method?No, you cannot create an object of a class that has abstract methods because such a class is abstract and incomplete.Click to reveal answer
beginner
How do you declare an abstract method in Java?
Use the
abstract keyword before the method signature and do not provide a method body. For example: abstract void myMethod();Click to reveal answer
intermediate
What must a subclass do if its superclass has abstract methods?The subclass must provide concrete implementations (bodies) for all inherited abstract methods, or it must also be declared abstract.Click to reveal answer
intermediate
Why use abstract methods in Java?
Abstract methods define a contract for subclasses, ensuring they implement specific behaviors while allowing different implementations.
Click to reveal answer
Which keyword is used to declare an abstract method in Java?
✗ Incorrect
The
abstract keyword declares a method without a body, requiring subclasses to implement it.Can an abstract method have a method body in Java?
✗ Incorrect
Abstract methods cannot have a body; they only declare the method signature.
What happens if a subclass does not implement all abstract methods from its abstract superclass?
✗ Incorrect
If a subclass does not implement all abstract methods, it must also be declared abstract.
Can you instantiate an abstract class directly?
✗ Incorrect
Abstract classes cannot be instantiated directly because they may have incomplete methods.
Which of the following is true about abstract methods?
✗ Incorrect
Abstract methods must be implemented by subclasses to provide specific behavior.
Explain what an abstract method is and why it is useful in Java.
Think about how abstract methods help define rules for subclasses.
You got /4 concepts.
Describe the rules a subclass must follow when inheriting abstract methods.
Focus on subclass responsibilities with abstract methods.
You got /3 concepts.