-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBox.java
More file actions
executable file
·37 lines (28 loc) · 608 Bytes
/
Box.java
File metadata and controls
executable file
·37 lines (28 loc) · 608 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
package ch03_oops.overloading;
public class Box {
void findArea(int length) {
System.out.println("Area (1 arg) = " + (length * length));
}
void findArea(double length) {
System.out.println("Double Area = " + (length * length));
}
void findArea(int length, int width) {
System.out.println("Area (2 args) = " + (length * width));
}
int add(int a, int b) {
return b;
}
float add(float a, int b) {
return b;
}
float add(int a, float b) {
return b;
}
void add(float a) {
}
int add(int a) {
return a;
}
void add(int a) {
}// error conflict with the method int add(int a)
}