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. very simple example.....................
View Tutorial          By: kajal at 2015-08-22 09:28:16

2. Hello,
I want to attend Sun certified Java

View Tutorial          By: Ganeshraje Bhosale at 2015-08-17 05:22:00

3. Hi,
i tried this way.that works perfectly.

View Tutorial          By: indu at 2009-06-08 03:13:51

4. thanks - this really helped!!
View Tutorial          By: mike at 2012-06-14 19:45:17

5. Please note that the above code does not work with
View Tutorial          By: mk at 2012-02-14 15:37:02

6. when I exported the data to excel there is a value
View Tutorial          By: mizhelle at 2015-10-10 13:17:56

7. Awesome script. works like a charm.


View Tutorial          By: blestab at 2011-03-02 04:32:35

8. HI all,

I am not able to call SMSC

View Tutorial          By: chinnadurai at 2009-08-26 23:58:54

9. Very helpful tutorial for me.
Thank you for

View Tutorial          By: Mohan at 2012-05-28 00:12:56

10. Sorry about this. I cannot run this program becaus
View Tutorial          By: TanSW at 2008-04-28 20:14:20