Method overriding is possible only when the following things are satisfied: A class inherits from another class (inheritance). Both super class and sub class should contain a method with same signature. Note: Method overriding does not depend up on the return type of the method and the access specifiers like (public, private, protected etc..). What is the difference between method overloading and method overriding? Both may look similar but they are quite different in the following ways: Method overloading takes place when a class contains multiple methods with the same name but varying number of parameters or types of parameters.
The post What is the correct use case of the Method overriding in java appeared first on Coding Security.
What is the correct use case of the Method overriding in java
read more
Tidak ada komentar:
Posting Komentar