-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstructorOverloading.java
More file actions
37 lines (34 loc) · 960 Bytes
/
ConstructorOverloading.java
File metadata and controls
37 lines (34 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class Shape
{
void show(/*no parameters (arguments) */)
{
System.out.println("hello i am a no argument function");
}
void show(int a,char ch)
{
System.out.println("hello i am single argument function " +a);
}
void show(char ch,int a)
{
System.out.println("hello i am single argument function " +a);
}
void show(int ch,int a)
{
System.out.println("hello i am single argument function " +a);
}
void show(double ch,double a)
{
System.out.println("hello i am single argument function " +a);
}
}
public class ConstructorOverloading {
public static void main(String[] args) {
Shape objShape=new Shape();
objShape.show();
objShape.show(56d,100D);
// Shape objShape2=new Shape();
// System.out.println(objShape);
// System.out.println(objShape2);
// System.out.println(objShape2 instanceof Shape);
}
}