Recall & Review
beginner
What is an abstract class in Java?An abstract class is a class that cannot be instantiated on its own and is meant to be a base class. It can have abstract methods (without body) that must be implemented by subclasses.Click to reveal answer
beginner
Can an abstract class have concrete (non-abstract) methods?Yes, an abstract class can have both abstract methods and concrete methods with full implementations.Click to reveal answer
beginner
What keyword is used to declare an abstract class and an abstract method in Java?The keyword <code>abstract</code> is used before the class name to declare an abstract class and before a method signature to declare an abstract method.Click to reveal answer
beginner
Why can't you create an object of an abstract class?
Because abstract classes are incomplete by design (they may have abstract methods without implementation), Java prevents creating objects from them to avoid errors.
Click to reveal answer
intermediate
How do subclasses relate to abstract classes?
Subclasses must provide implementations for all abstract methods of the abstract class, or they must also be declared abstract.
Click to reveal answer
Which of the following is true about abstract classes in Java?
✗ Incorrect
Abstract classes cannot be instantiated directly. They can have methods with implementation, and they are different from interfaces. Also, an abstract class can have zero or more abstract methods.
What happens if a subclass does not implement all abstract methods of its abstract superclass?
✗ Incorrect
If a subclass does not implement all abstract methods, it must also be declared abstract.
Which keyword is used to declare an abstract method?
✗ Incorrect
The keyword
abstract is used to declare a method without a body in an abstract class.Can an abstract class have constructors?
✗ Incorrect
Abstract classes can have constructors which are called when subclasses are instantiated.
Which statement about abstract classes is false?
✗ Incorrect
You cannot create an object of an abstract class directly using the new keyword.
Explain what an abstract class is and why it is useful in Java.
Think about a blueprint that is incomplete but guides other classes.
You got /5 concepts.
Describe the rules for subclassing an abstract class in Java.
Focus on what the subclass must do with abstract methods.
You got /4 concepts.