nerdexam
Oracle

1Z0-803 · Question #41

Which two statements are true?

The correct answer is A. An abstract class can implement an interface. E. An abstract class can be extended by a concrete class.. This question evaluates knowledge of core object-oriented programming concepts related to inheritance and interface implementation rules between abstract classes, concrete classes, and interfaces.

Working with Inheritance

Question

Which two statements are true?

Options

  • AAn abstract class can implement an interface.
  • BAn abstract class can be extended by an interface.
  • CAn interface CANNOT be extended by another interface.
  • DAn interface can be extended by an abstract class.
  • EAn abstract class can be extended by a concrete class.
  • FAn abstract class CANNOT be extended by an abstract class.

How the community answered

(17 responses)
  • A
    94% (16)
  • D
    6% (1)

Why each option

This question evaluates knowledge of core object-oriented programming concepts related to inheritance and interface implementation rules between abstract classes, concrete classes, and interfaces.

AAn abstract class can implement an interface.Correct

An abstract class can implement one or more interfaces. It is not required to provide concrete implementations for all interface methods; any unimplemented methods remain abstract, and the class itself remains abstract.

BAn abstract class can be extended by an interface.

Interfaces cannot extend classes (abstract or concrete). Interfaces extend other interfaces to form an inheritance hierarchy for interface contracts.

CAn interface CANNOT be extended by another interface.

Interfaces can indeed extend other interfaces, allowing for the combination of method signatures from multiple interfaces into a single new interface.

DAn interface can be extended by an abstract class.

An abstract class *implements* an interface; it does not *extend* it. Extension (`extends`) is used for class-to-class inheritance or interface-to-interface inheritance.

EAn abstract class can be extended by a concrete class.Correct

A concrete class can extend an abstract class. When a concrete class extends an abstract class, it is obligated to provide concrete implementations for all abstract methods inherited from its abstract superclass.

FAn abstract class CANNOT be extended by an abstract class.

An abstract class can be extended by another abstract class. This allows for creating hierarchies of abstraction, where a subclass abstract class can further define or override abstract methods.

Concept tested: OOP inheritance and interface implementation rules

Source: https://docs.oracle.com/javase/tutorial/java/IandI/abstract.html

Topics

#abstract classes#interfaces#inheritance#polymorphism

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice