Java OCA OCP Practice Question 1502

Question

Which of the following class types cannot be marked final or abstract?

  • A. Static nested class
  • B. Local inner class
  • C. Anonymous inner class
  • D. Member inner class


C.

Note

While an anonymous inner class can extend another class or implement an interface, it cannot be declared final or abstract since it has no class definition.

Option C is correct.

The other classes may be declared final or abstract since they have a class definition.




PreviousNext

Related