Click here to watch in Youtube :
https://www.youtube.com/watch?v=LtqULqLn06Q&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Polymorphism(version1) |
Java Tutorial : Java Polymorphism(version1) |
Java Tutorial : Java Polymorphism(version1) |
public class MethodOverloadingExample { public void add(int a, int b) { int total = a + b; System.out.println("total : " + total); } public void add(int a, int b, long c) { long total = a + b + c; System.out.println("total : " + total); } public static void main(String args[]) { MethodOverloadingExample methodOverloadingExample= new MethodOverloadingExample(); //Call two parameter add method methodOverloadingExample.add(2,2); //Call three parameter add method methodOverloadingExample.add(5, 5, 5L); } }
total : 4 total : 15
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..."); } } public class MethodOverridingExample { public static void main(String args[]) { Animal animalRef = new Lion(); animalRef.eat(); } }
Lion is Eating meat...
https://sites.google.com/site/javaee4321/java/MethodOverridingDemo_version3-App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/MethodOverridingDemo_version3-App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/c2560ad00704183985b315e600962c202910d529/BasicJava/MethodOverridingDemo_version3-App/?at=master
See also:
Nice. Also check web methods training
ReplyDeletebusiness analyst online training