Java-Method Overloading

Method Overloading Method overriding occurs only when the names and the types signatures of the two methods are identical. If they are not, then the two methods are simply overloaded. Program Program Source class Data { int data1; int data2; void dataValues() { System.out.println(“data1 = “+data1); System.out.println(“data2 = “+data2); } } class NewData extends Data … Read more…

Java-Method Overloading

Method Overloading Two or more methods in a class with the same name but different parameter. This technique is called method overloading. Method overloading is used when objects are required to perform similar tasks but using different input parameters. When we call a method in an object, Java matches up the method name first and … Read more…