Click here to watch in Youtube :
https://www.youtube.com/watch?v=jAfw5OAZkmg&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Runtime Polymorphism(version2) |
class Animal { void whoAmI() { System.out.println("I am a generic Animal."); } } class Dog extends Animal { void whoAmI() { System.out.println("I am a Dog."); } } class Lion extends Animal { void whoAmI() { System.out.println("I am a Lion."); } } class Tiger extends Animal { void whoAmI() { System.out.println("I am a Tiger."); } }
public class RunTimePolymorphismDemo { public static void main(String[] args) { Animal animalRef = new Animal(); animalRef.whoAmI(); animalRef = new Dog(); animalRef.whoAmI(); animalRef = new Lion(); animalRef.whoAmI(); animalRef = new Tiger(); animalRef.whoAmI(); } }
I am a generic Animal. I am a Dog. I am a Lion. I am a Tiger.
https://sites.google.com/site/javaee4321/java/PolymorphismDemo_Runtime_V2_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/PolymorphismDemo_Runtime_V2_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/527ec09d8e1fd3cdfc42e1a5df2ff8d97e615036/BasicJava/PolymorphismDemo_Runtime_V2_App/?at=master
See also:
Nice lecture. Also check azure devops training
ReplyDeletescala training
sccm training
ReplyDeleteGreat content thanks for sharing this informative blog.
Best Advanced Java Online Training
Best Java Training in Hyderabad