Question discussion

Which of the following statement is/are correct regarding JAVA programming?I. A class marked as final cannot be inheritedII. A method marke…

5234Medium DSSSB TGT Computer Science 0 replies 0 views
0
Which of the following statement is/are correct regarding JAVA programming?
I. A class marked as final cannot be inherited
II. A method marked final cannot be overridden
  • ABoth I and II
  • BOnly I
  • CNeither I nor II
  • DOnly II
Correct answer: A

Explanation

A class marked final cannot be inherited and a method marked final cannot be overridden, so both are correct.

Discussion 0

Nobody has replied yet. Start the discussion!