-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstraction.java
More file actions
46 lines (38 loc) · 892 Bytes
/
Abstraction.java
File metadata and controls
46 lines (38 loc) · 892 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
45
46
abstract class Shape{
abstract void showShape();
void shape(){
System.out.println("This is the Abstract Class");
}
}
class Sphere extends Shape{
void showShape(){
System.out.println("This is a Sphere");
}
}
class Cone extends Shape{
void showShape(){
System.out.println("This is a Cone");
}
}
class Square extends Shape{
void showShape(){
System.out.println("This is a Square");
}
}
class Rectangle extends Shape{
void showShape(){
System.out.println("This is a Rectangle");
}
}
public class Abstraction {
public static void main(String[] args){
Sphere A= new Sphere();
Cone B= new Cone();
Square C= new Square();
Rectangle D= new Rectangle();
A.showShape();
B.showShape();
C.showShape();
D.showShape();
}
}