1Z0-811 Object-Oriented Programming Practice Question
Exhibit
public class Test { public static void main(String[] args) { Animal a = new Animal(); a.sound(); } } abstract class Animal { abstract void sound(); }Refer to the exhibit. Why does the code fail to compile?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Cannot instantiate an abstract class
Abstract classes cannot be instantiated. The attempt to create a new Animal() causes a compile-time error because Animal is abstract.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Animal must be declared as interface
Why it's wrong here
Animal could be an interface, but the problem is specifically instantiation of an abstract class.
- ✗
The main method is in the wrong class
Why it's wrong here
main can be placed in any class.
- ✗
The sound() method is not defined
Why it's wrong here
sound() is defined as an abstract method; the error is not about missing definition.
- ✓
Cannot instantiate an abstract class
Why this is correct
Correct. Abstract classes cannot be instantiated directly.
Go deeper
Related to this question
About these practice questions
One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.