Object-Oriented Programming · Question 8 · Medium

Which statement about abstract classes and interfaces in Java is correct?

  1. An interface can declare constructors
  2. An abstract class can be instantiated directly with new
  3. An abstract class can have constructors, but an interface cannot
  4. A Java class can extend more than one abstract class
Answer and explanation

Answer: C. An abstract class can have constructors, but an interface cannot

Explanation: An abstract class can define constructors, which run when a subclass object is created. Interfaces cannot have constructors. Java allows only single class inheritance, and abstract classes cannot be instantiated.

Previous: What is the output of the following Java code? · Next: In C++, how is the "diamond problem" (two copies of a common base class…

Practise object-oriented programming

Try a fresh set of object-oriented programming questions with an explanation after every answer, free and without signing up: Object-Oriented Programming practice. Or sit a full placement mock test.

More object-oriented programming questions

More technical & programming practice

DBMS · SQL · Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps · GenAI Basics · Pseudo-code

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge