In this article we will look at method overriding which is similar to method overloading. Method overriding is a mechanism which supports polymorphism in Java. What is method overriding? In the context of inheritance, suppose a base class A contains a method display with zero parameters and sub class B also contains a method display with zero parameters, what happens when we create an object for class B and call the display method using that object? The method that will execute is the display method in the sub class B. Then what happened to the display method in super class A? It was hidden. This process of
The post How to override methods in java appeared first on Coding Security.
How to override methods in java
read more
Tidak ada komentar:
Posting Komentar