Isn't it redundant to have to mark the methods final if the class is final?

Questions by krishna_darl   answers by krishna_darl

Showing Answers 1 - 2 of 2 Answers

pyscho

  • Jun 26th, 2006
 

If a class is marked final it means that the reference to this class cannot be changed and the methods marked final mean that they cannot be overridden

  Was this answer useful?  Yes

cognizance

  • Nov 23rd, 2006
 

The answer to the original question is ?yes? it is redundant. Some code analysis tools like checkstyle will highlight it as such.To correct the comment by psycho, marking a class as final prevents it from being extended.Marking a variable as final indeed prevents it from being reassigned.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.