+ 3
What is overriding in java
how do we ov erride methods in java and why is it done.If possible please make a program to give me an example
5 Respostas
+ 3
Method overriding, in object oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes. Signature should be same , that is :
Rules for Java Method Overriding
method must have same name as in the parent class
method must have same parameter as in the parent class.
must be IS-A relationship (inheritance).
If you want to read more see here:- http://crbtech.in/Java-Training/method-overloading-overriding-java-2/
+ 2
pls instead of linking to other questions just give explaination in simple words
+ 2
can anyone tell me why if we want a different implementation of a method of parent class in sub class,why don't we write a new method with a new name than create a method that has same name as method of parent class but has different code.
what is advantage of overriding over creating a new method for sub class.We need to write more code for method anyway
+ 1
pranit answer above