Click here to watch in Youtube :
https://www.youtube.com/watch?v=rttH7OiM7SE&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Polymorphism(version3) |
Java Tutorial : Java Polymorphism(version3) |
Java Tutorial : Java Polymorphism(version3) |
Java Tutorial : Java Polymorphism(version3) |
Java Tutorial : Java Polymorphism(version3) |
Java Tutorial : Java Polymorphism(version3) |
public class Animal { public void makeNoise() { System.out.println("Some sound."); } } class Lion extends Animal { public void makeNoise() { System.out.println("Roar."); } } class Dog extends Animal { public void makeNoise() { System.out.println("Bark."); } }
public class PolymorphismTest { public static void main(String[] args) { Animal animalRef = new Lion(); animalRef.makeNoise();//Prints Roar. animalRef = new Dog(); animalRef.makeNoise();//Prints Bark. } }
Roar. Bark.
https://sites.google.com/site/javaee4321/java/PolymorphismDemo_V3_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/PolymorphismDemo_V3_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/c2560ad00704183985b315e600962c202910d529/BasicJava/PolymorphismDemo_V3_App/?at=master
See also:
No comments:
Post a Comment