-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFinal4.java
More file actions
55 lines (42 loc) · 741 Bytes
/
Copy pathFinal4.java
File metadata and controls
55 lines (42 loc) · 741 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
52
53
54
55
//code to inherit final class
import java.lang.*;
final class Base
{
public void fun()
{
System.out.println("Base fun");
}
}
/*class Derived extends Base
{
} */
class Derived
{
public Base bobj=new Base(); //Composition
public void gun()
{
System.out.println("Derived gun");
}
}
class Final4
{
public static void main(String arg[])
{
Derived dobj=new Derived();
dobj.bobj.fun();
dobj.gun();
}
}
/*
final class System
{
public static PrintStream out=new PrintStream();
}
class PrintStream
{
public void println(String str)
{
}
}
System.out.println("Hello....";)
*/