Java program to implement constructor overloading by passing different number of parameter of different types.
{
int length, breadth, height;
{
length = breadth = height = 2;
{
length = l;
breadth = b;
height = 2;
System.out.
println
("Initialized with parameterized constructor having 2 params");
}
{
length = l;
breadth = b;
height = h;
System.out.
println ("Initialized with parameterized constructor having 3 params");
} public int getVolume ()
{
return length * breadth * height;
}
{
}}
Java program to implement constructor overloading by passing different number of parameter of different types.
Reviewed by
on
September 05, 2019
Rating:

No comments: