+ 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

24th May 2018, 1:08 PM
Divyansh Dabral
Divyansh Dabral - avatar
5 Respuestas
+ 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/
25th May 2018, 6:28 AM
pranit patil
pranit patil - avatar
+ 2
pls instead of linking to other questions just give explaination in simple words
24th May 2018, 2:58 PM
Divyansh Dabral
Divyansh Dabral - avatar
+ 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
25th May 2018, 12:06 PM
Divyansh Dabral
Divyansh Dabral - avatar
+ 1
pranit answer above
25th May 2018, 8:47 AM
Apple Blossom
Apple Blossom - avatar