-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
23 lines (21 loc) · 881 Bytes
/
Copy pathMain.java
File metadata and controls
23 lines (21 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// import Geometry.OtherShapes.*;
// import Geometry.otherShapes.Triangle;
import Geometry.*;
// import Geometry.*;
public class Main {
public static void main(String[] args) {
Rectangle obj = new Rectangle(4.5,5.0);
double area = obj.Area();
System.out.println("Area of rectangle : "+ area);
Square obj1 = new Square(10);
int areaa = obj1.Area();
System.out.println("Area of Square : "+ areaa);
Geometry.OtherShapes.Triangle obj2 = new Geometry.OtherShapes.Triangle(3.0,5.0 );
double a = obj2.Area();
System.out.println("Area of Triangle : "+ a);
// System.out.println(obj2.side); DEFAULT
// error: side is not public in Triangle; cannot be accessed from outside package
// System.out.println(obj2.def); PROTECTED
// error: def has protected access in Triangle
}
}