Click here to watch in Youtube :
https://www.youtube.com/watch?v=7RZhps1BHuY&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Polymorphism(version2) |
public class Animal { public void eat() { System.out.println("Animal is eating..."); } } class Lion extends Animal { public void eat() { System.out.println("Lion is Eating meat..."); } } class Dog extends Animal { public void eat() { System.out.println("Dog is Eating chicken..."); } }
public class PolymorphismTest { public static void main(String[] args) { Animal animalRef = new Lion(); animalRef.eat(); animalRef = new Dog(); animalRef.eat(); } }
Lion is Eating meat... Dog is Eating chicken...
https://sites.google.com/site/javaee4321/java/PolymorphismDemo_V2_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/PolymorphismDemo_V2_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/c2560ad00704183985b315e600962c202910d529/BasicJava/PolymorphismDemo_V2_App/?at=master
See also:
Nice post. Also check oracle rac online training
ReplyDeletemsbi online training
osb training