Comment on Tutorial - Method Overloading sample in Java By Ganesh Iyer
Comment Added by : ITMIT
Comment Added at : 2011-06-05 19:16:46
Comment on Tutorial : Method Overloading sample in Java By Ganesh Iyer
public class Overload2 {
void add(int m, int n)
{
int sum = m + n;
System.out.println( "Sum of a+b is " +sum);
}
void add(int a, int b, int c) {
int sum = a + b + c;
System.out.println("Sum of a+b+c is " +sum);
}
void add(double a, double b) {
double sum = a + b;
System.out.println("Sum of a+b is "+sum);
}
void add(String s1, String s2)
{
String s = s1+s2;
System.out.println(s);
}
}
class overloadfunc{
public static void main(String args[])
{
Overload2 obj = new Overload2();
obj.add(4,19);
obj.add(4,17,11);
obj.add(1.5,21.5);
obj.add("Life at"," the speed of rail ");
}
}
Output will be:
Sum of a+b is 23
Sum of a+b+c is 32
Sum of a+b is 23.0
Life at the speed of rail
View Tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Java program to get location meta data from an image
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
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
Archived Comments
1. Great sample. Happy I found this site.
View Tutorial By: javaslave at 2008-08-03 04:43:20
2. i want to study c-programming language
View Tutorial By: rajesh at 2008-07-27 07:43:09
3. thanx it was really helpful
View Tutorial By: Vidisha at 2010-07-09 06:21:32
4. Thanks so much, this was extremely helpful and rea
View Tutorial By: gabrielle at 2013-10-04 22:07:17
5. Dude how did you used out.print() method it is giv
View Tutorial By: Hardik at 2013-02-18 15:37:09
6. best site ever.
View Tutorial By: rehan ahmed at 2008-12-10 02:21:32
7. hi Ashray P Shetty,
I'm getting the followi
View Tutorial By: Balaji at 2010-11-25 14:16:23
8. i want to more explanation about serlization
View Tutorial By: sumathi at 2013-12-22 15:00:20
9. hi i m deepika mittal . i m working on the same pr
View Tutorial By: deepika Mittal at 2009-05-30 06:55:22
10. i want to know more sample codes in object oriente
View Tutorial By: glades at 2013-01-23 08:28:33