-
Notifications
You must be signed in to change notification settings - Fork 0
/
Abstract
68 lines (34 loc) · 791 Bytes
/
Abstract
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package abstractAndConcreet;
abstract class Base{
void fun() {
System.out.println("The conatructor of Abstract class");
}
public abstract void method();
}
class Derived extends Base{
String name;
Derived(String name){
this.name=name;
}
public void method() {
System.out.println("Method of Derived " + name);
}
}
class dev extends Base{
int number ;
dev(int number){
this.number=number;
}
public void method() {
System.out.println("Method of Dev " + number);
}
}
public class abstract2 {
public static void main(String[] args) {
Base obj= new Derived("Hamza");
Base obj2= new dev(24);
obj.method();
obj2.method();
obj2.fun();
}
}