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. It is very useful.thank you so much.
View Tutorial          By: Pratiksha ijagaj at 2010-11-27 07:03:52

2. it is gooo...very helpful to know the basics
View Tutorial          By: srikanth at 2010-08-24 00:38:57

3. Good Example esp. way it was presented.
View Tutorial          By: Arunlal at 2013-06-20 11:56:43

4. Thanks For uploading , Can you please guide , How
View Tutorial          By: Manish Choudhari at 2014-10-14 09:58:05

5. i need java simple programs
View Tutorial          By: Tharani at 2010-01-22 06:39:25

6. Good Explanation.
View Tutorial          By: Ashishkumar Haldar at 2013-01-03 11:47:25

7. Hi. When i click on Install certificate. It tells
View Tutorial          By: jaris at 2011-10-18 11:00:41

8. hey usharadha and all other friends...i hv taken a
View Tutorial          By: abdur at 2012-02-03 15:56:10

9. I want to redirect from a servlet page to another
View Tutorial          By: dinesh at 2014-10-20 16:44:26

10. Mail me Codings in java of different programs
View Tutorial          By: vikram at 2008-09-12 06:04:42