-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathj46AbstractClass.java
More file actions
34 lines (31 loc) · 951 Bytes
/
j46AbstractClass.java
File metadata and controls
34 lines (31 loc) · 951 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
abstract class Base4{
public Base4(){
System.out.println("Base 4 constructor");
}
public void sayHello(){
System.out.println("Hello boy");
}
// abstract metheod
abstract public void welcome();
}
class Derived4 extends Base4{
@Override
public void welcome(){
System.out.println("Abstract metheod of welxcome class Base4");
}
public void Derived4_meth1(){
System.out.println("this is Derived4_meth1");
}
}
public class j46AbstractClass{
public static void main(String[] args){
// we canot use abstract class directly into a program
// abstract class are used as reference for other classes
// Base4 = b = new Base4; // not use bc this is abstract class
Derived4 d = new Derived4();
Base4 bb = new Derived4();
d.welcome();
d.Derived4_meth1();
bb.sayHello();
}
}