Live Webinar: Prompt Engineering: Skill Everyone Must Learn Today
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Java - Method Overloading Concept
WhatsApp
Senthilvelan Sambamoorthy
Jul 29
2016
571
0
0
class
methover
{
void
sum(
int
a,
int
b)
{
System.out.println(
"integer value : "
+(a+b));
}
void
sum(
double
a,
double
b)
{
System.out.println(
"double value : "
+(a+b));
}
void
sum(
float
a,
float
b)
{
System.out.println(
"float value : "
+(a+b));
}
void
sum(
byte
a,
byte
b)
{
System.out.println(
"byte value : "
+(a+b));
}
void
sum(
short
a,
short
b)
{
System.out.println(
"short value : "
+(a+b));
}
void
sum(
long
a,
long
b)
{
System.out.println(
"long value : "
+(a+b));
}
void
sum(String a, String b)
{
System.out.println(
"string value : "
+(a+b));
}
public
static
void
main(String arg[])
{
methover t =
new
methover();
t.sum(
5
,
10
);
t.sum(
10.3
,
14.2
);
t.sum(
5.3
,
3.2
);
t.sum(
100
,-
50
);
t.sum(
10000
,-
20000
);
t.sum(
250
,
200
);
t.sum(
"ssv"
,
"ksv"
);
}
}
Method Overloading
Java
Up Next
Java - Method Overloading Concept