-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAbstractDemo1.java
More file actions
51 lines (42 loc) · 953 Bytes
/
Copy pathAbstractDemo1.java
File metadata and controls
51 lines (42 loc) · 953 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
47
48
49
50
51
import java.lang.*;
abstract class Demo
{
public int i,j;
public Demo()
{
System.out.println("Demo constructor");
}
public void fun() //concrete
{
System.out.println("Demo fun");
}
public abstract void gun(); //abstract virtual void gun()=0;
}
class Hello extends Demo
{
public int x,y;
public Hello()
{
System.out.println("hello constructor");
}
public void sun() //concrete
{
System.out.println("hello sun");
}
public void gun() //concrete
{
System.out.println("hello gun");
}
}
class AbstractDemo1
{
public static void main(String a[])
{
Demo dobj; //we can create reference of abstract class
// dobj=new Demo(); we cant create object of abstract class
Hello hobj=new Hello();
hobj.fun();
hobj.gun();
hobj.sun();
}
}