What is Method Overriding in java / Function overriding in java

Pubblicato il: 01 gennaio 1970
sul canale di: Techies Tute
517
14

#methodOverriding #java

It allows a sub-class or child class to provide a specific implementation of a method that is already provided by one of its super-classes or parent classes.
Rules:
There must be an IS-A relationship (inheritance).
Method overriding return type, access modifier, method name, and method parameter must be same in subclass.
When we declare any method as final in super class at that time we can not override that method.
for method overriding access specifier of the sub class method must be same or wider than super class.
The @Override annotation is one of a default Java annotation and it can be introduced in Java 1.5 Version
The @Override annotation indicates that the child class method is over-writing its base class method.
@Override provides to check the method signature in sub class as per super class method signature at compile-time. If not matches then it show error.


In questa pagina del sito puoi guardare il video online What is Method Overriding in java / Function overriding in java della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Techies Tute 01 gennaio 1970, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 517 volte e gli è piaciuto 14 spettatori. Buona visione!