TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Java Overloading Constructor
Senthilvelan Sambamoorthy
Sep 28, 2019
3.5
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
In this Java Program, easy to understand Overloading Constructor concept in Java.
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
Overloading Constructor
Constructor
Overloading
Next Recommended Reading
Copying The Values of One Object to Another Using Constructor in Java