Click here to watch in Youtube :
https://www.youtube.com/watch?v=R-LO5JjAtBM&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Polymorphism(version4) |
Java Tutorial : Java Polymorphism(version4) |
Java Tutorial : Java Polymorphism(version4) |
Java Tutorial : Java Polymorphism(version4) |
Java Tutorial : Java Polymorphism(version4) |
Java Tutorial : Java Polymorphism(version4) |
public class OverloadingTest { public int add(int x, int y) { return x + y; } public int add(int x, int y, int z) { return x + y + z; } public int add(double x, int y) { return (int) x + y; } public int add(int x, double y) { return x + (int) y; } public static void main(String[] args) { OverloadingTest overloadingTest = new OverloadingTest(); System.out.println(overloadingTest.add(4, 3)); System.out.println(overloadingTest.add(2, 3, 4)); System.out.println(overloadingTest.add(2.5, 3)); System.out.println(overloadingTest.add(9, 3.4)); } }
7 9 5 12
class Vehicle { public void move() { System.out.println("Vehicles can move"); } } class Car extends Vehicle { public void move() { System.out.println("Car can move very fast"); } } public class OverriddenTest { public static void main(String[] args) { Vehicle vehicleRef = new Car(); vehicleRef.move(); // prints Car can move very fast vehicleRef = new Vehicle(); vehicleRef.move(); // prints Vehicles can move" } }
Car can move very fast Vehicles can move
https://sites.google.com/site/javaee4321/java/PolymorphismDemo_V4_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/PolymorphismDemo_V4_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/527ec09d8e1fd3cdfc42e1a5df2ff8d97e615036/BasicJava/PolymorphismDemo_V4_App/?at=master
See also:
Great Post. Keep updating, oracle rac online training
ReplyDeletemsbi online training
osb training