- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstructor_practice.java
More file actions
Latest commit
44 lines (35 loc) · 803 Bytes
/
Copy pathconstructor_practice.java
File metadata and controls
44 lines (35 loc) · 803 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
38
39
40
41
42
43
44
packagecom.company;
classRectangle1{
intwidth;
intlength;
publicRectangle1(intwidth, intlength) {
this.width = width;
this.length = length;
}
publicRectangle1() {
this.width = 5;
this.length = 4;
}
publicintgetWidth() {
returnwidth;
}
publicvoidsetWidth(intwidth) {
this.width = width;
}
publicintgetLength() {
returnlength;
}
publicvoidsetLength(intlength) {
this.length = length;
}
intarea()
{
returnlength*width;
}
}
publicclassconstructor_practice {
publicstaticvoidmain(String[] args) {
Rectangle1r1=newRectangle1();
System.out.println(r1.area());
}
}