Question discussion

Which of the following demonstrates the implementation of inheritance in Java?

358831Medium DSSSB TGT Computer Science 0 replies 0 views
0
Which of the following demonstrates the implementation of inheritance in Java?
  • Aclass B inherits A {}
  • Bclass A contains B {}
  • Cclass A implements B {}
  • Dclass A extends B {}
Correct answer: D

Explanation

In Java a class inherits another class with the extends keyword, so "class A extends B {}" is correct.

Discussion 0

Nobody has replied yet. Start the discussion!