forked from Annex5061/java-algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabstract _class_java
More file actions
44 lines (34 loc) · 754 Bytes
/
abstract _class_java
File metadata and controls
44 lines (34 loc) · 754 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
//the abstract class can not become a object it is features of it.
abstract class shape
{
void display()
{
}
}
class cir extends shape{
void display()
{
System.out.println("shape is circle is right now");
}
}
class rectan extends shape{
void display()
{
System.out.println("the shape is rectangle");
}
}
public class abstaract {
public static void main(String[] args)
{
///abstract class object
//error like this:'shape' is abstract; cannot be instantiated
//shape s=new shape();
// s.display();
//instance is cir
shape s =new cir();
s.display();
//instance is rectan
s=new rectan();
s.display();
}
}