Click here to watch in Youtube :
https://www.youtube.com/watch?v=tc61YEXJD1Y&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java method overriding(Inherited instance method) |
public interface Animal { void run(); }
public class Tiger { public void run() { System.out.println("Tiger runs fast."); } }
public class WhiteTiger extends Tiger implements Animal { }
public class MethodOverrideTest { public static void main(String[] args) { WhiteTiger whiteTigerObj = new WhiteTiger(); whiteTigerObj.run(); } }
Tiger runs fast.
https://sites.google.com/site/javaee4321/java/MethodOverridingDemo-Inherited-instance-methods-App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/MethodOverridingDemo-Inherited-instance-methods-App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/fa67e02bcd9efeae1c2ea3019677c5252e4db5f7/BasicJava/MethodOverridingDemo-Inherited-instance-methods-App/?at=master
See also:
In Java that was considered to be too dangerous so you can inherit from a main class, but you can "inherit" behaviors from interfaces, which are for all intents and purposes abstract classes with no fields or method implementations.
ReplyDeletejava training in chennai
Acquire the trending Selenium training in Chennai from the best software training institute in Chennai, Infycle Technologies. Additionally, we come up with the latest demanded technological courses like Python, Data Science, Digital Marketing, Big Data, Oracle, AWS, Azure, Google Cloud, Java, and Oracle with the best faculties in the industry. To clear your doubts, call +91-7504633633 or +91-7502633633.
ReplyDelete