C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
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 Overloading Constructor
WhatsApp
Senthilvelan Sambamoorthy
5y
3.7
k
0
1
25
Blog
Introduction
In this blog, I will explain about Overloading Constructor in Java. It is effortless in Java Programming. The output will be displayed in the Run module.
Software Requirement
JDK1.3
Simple program
class
overlo {
double
x, y;
overlo(
double
a,
double
b) {
x = a;
y = b;
}
public
void
squ() {
System.out.println(
"The Area of Square : "
+ (x * x));
}
public
void
rec() {
System.out.println(
"The Area of Rectangle : "
+ (x * y));
}
public
void
cir() {
System.out.println(
"The Area of Circle : "
+ (
3.14
* x * x));
}
public
static
void
main(String arg[]) {
overlo t;
t =
new
overlo(
4
,
4
);
t.squ();
t =
new
overlo(
5
,
6
);
t.rec();
t =
new
overlo(
2
,
3
);
t.cir();
}
}
Output
People also reading
Membership not found