-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuper keyword
78 lines (64 loc) · 1.07 KB
/
super keyword
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
69
70
71
72
73
74
75
76
import java.lang.*; //syatem library file
import java.lang.reflect.Array;
import java.io.*; //printstream classes
import java.util.*; //bcz of scanner class
import java.io.*;
class paras
{
void fn()
{
System.out.println("hey paras");
}
}
class bhatt extends paras
{
void fn()
{
super.fn();
}
}
public class UdemyClasses extends bhatt
{
public static void main(String agrs[])
{
bhatt obj = new bhatt();
obj.fn();
}
}
*********************************NEXT EXAMPLE****************************************
import java.lang.*; //syatem library file
import java.lang.reflect.Array;
import java.io.*; //printstream classes
import java.util.*; //bcz of scanner class
import java.io.*;
class paras
{
void fn()
{
System.out.println("hey paras");
}
}
class bhatt extends paras
{
void fn()
{
super.fn();
System.out.println("hey bhatt");
}
}
class pb extends bhatt
{
void fn()
{
super.fn();
System.out.println("hey pb");
}
}
public class UdemyClasses extends pb
{
public static void main(String agrs[])
{
pb obj = new pb();
obj.fn();
}
}