forked from adarshpandey10t/Hacktoberfestmine
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodOverload.java
More file actions
Latest commit
31 lines (27 loc) · 707 Bytes
/
Copy pathMethodOverload.java
File metadata and controls
31 lines (27 loc) · 707 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
classValue {
voidDataType() {
System.out.println("\tI dont know who i am");
}
voidDataType(inta) {
System.out.println(a+"\tHi! I am an Integer");
}
voidDataType(floata) {
System.out.println(a+"\tI am a floating number");
}
voidDataType(chara) {
System.out.println(a+"\tHello! Its me character");
}
voidDataType(Stringa) {
System.out.println(a+"\tThis is a String");
}
}
classMethodOverload {
publicstaticvoidmain(Stringargs[]) {
Valueval = newValue();
val.DataType(22);
val.DataType(3.14f);
val.DataType('p');
val.DataType("pi");
val.DataType();
}
}