top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to make sure that Subclass method actually overrides the method of the superclass or parent class in Java?

+3 votes
633 views
How to make sure that Subclass method actually overrides the method of the superclass or parent class in Java?
posted Sep 22, 2013 by Manish Negi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

Due the presence of @Override annotation in the javadoc ,if you accidently miss an argument or capitalize the method name wrong, the compiler 'll generate a compile-time error.

answer Sep 23, 2013 by Arvind Singh
+1 vote

This is the perfect scenario to Use Abstract class .Make the method to be overriden abstract in parent class and mark the class as Abstract.

answer Oct 1, 2013 by Vikalp Kumar
...