Comment on Tutorial - Method Overloading sample in Java By Ganesh Iyer



Comment Added by : Subhojit Das

Comment Added at : 2014-10-09 07:31:20

Comment on Tutorial : Method Overloading sample in Java By Ganesh Iyer
//Program of Method Overloading with Runtime Values

import java.util.Scanner;


class cal
{
void add(int a,int b)
{
System.out.print("Addition of First 2No.s is : " +(a+b));
}

void add(int a,int b,int c)
{
System.out.print("Addition of Three No.s is : " +(a+b+c));
}

}

class mthdovrng
{
public static void main (String args[])
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("Enter First No. : ");
a=input.nextInt();
System.out.print("Enter Second No. : ");
b=input.nextInt();
System.out.print("Enter Third No. : ");
c=input.nextInt();
cal ob=new cal();
ob.add(a,b);
ob.add(a,b,c);
}
}


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Answer for comment 5
this loop is work infi

View Tutorial          By: salman at 2013-03-10 07:30:53

2. hi can any one help me how i can install javax.co
View Tutorial          By: Jewel at 2008-02-26 21:52:17

3. Your script works beautifully. Is there a way to i
View Tutorial          By: JW at 2013-05-08 22:22:44

4. Thanks,
But i would like to use an array li

View Tutorial          By: Gustavo at 2011-06-15 21:03:20

5. Java s ssssss
View Tutorial          By: zoya at 2012-04-27 12:24:59

6. Another solution to those, who feel that the probl
View Tutorial          By: Zoltán P. Ackermann at 2010-12-09 01:58:51

7. Thanks for the clear explanation..
Really h

View Tutorial          By: Swj at 2011-12-30 05:55:26

8. Thanks for example..
But I have the same p

View Tutorial          By: Lina at 2009-05-02 13:23:33

9. Good article
View Tutorial          By: Manu Francis Mathew at 2009-12-18 00:50:45

10. Hi all this program is working very fine .... i ha
View Tutorial          By: Ashish at 2009-03-25 04:28:25