-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangle.java
More file actions
41 lines (35 loc) · 731 Bytes
/
Rectangle.java
File metadata and controls
41 lines (35 loc) · 731 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
import java.util.*;
class Rectangle
{
int length;
int breath;
public void display()
{
System.out.println("Length=" + length);
System.out.println("Breath=" + breath);
}
public Rectangle()
{
length = 0;
breath = 0;
}
public Rectangle(int x)
{
length = x;
breath = x;
}
public Rectangle(int x, int x2)
{
length = x;
breath = x2;
}
public static void main(String[] arrstring)
{
Rectangle rect1 = new Rectangle();
rect1.display();
Rectangle rect2 = new Rectangle(2);
rect2.display();
Rectangle rect3 = new Rectangle(19,43);
rect3.display();
}
}