Thursday, 21 January 2016

Java Tutorial : Java method overriding(Inherited instance method)


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) 
Animal.java
public interface Animal
{
    void run();
}
Tiger.java
public class Tiger 
{
    public void run()
    {
        System.out.println("Tiger runs fast.");
    }
}
WhiteTiger.java
public class WhiteTiger extends Tiger implements Animal
{

}
MethodOverrideTest.java
public class MethodOverrideTest
{

    public static void main(String[] args)
    {
        WhiteTiger whiteTigerObj = new WhiteTiger();
        whiteTigerObj.run();
    }

}
Output
Tiger runs fast.
Click the below link to download the code:
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:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • 2 comments:

    1. 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.

      java training in chennai

      ReplyDelete
    2. 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