-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInnerClass.java
More file actions
79 lines (75 loc) · 2.25 KB
/
Copy pathInnerClass.java
File metadata and controls
79 lines (75 loc) · 2.25 KB
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
77
78
79
// NESTED INNER CLASS//
// class outer{
// int x=10;
// inner i =new inner();
// class inner{
// int y=20;
// public void innerDisplay(){System.out.println(x+" "+y);}
// }
// public void outerDisplay(){
// // inner i=new inner();
// i.innerDisplay();
// System.out.println(i.y);}}
// public class InnerClass {
// public static void main(String[] args) {
// outer o=new outer();
// o.outerDisplay();
// }
// }
// // LOCAL INNER CLASS//
// class Outer{
// public void display(){
// class Inner{
// public void show(){
// System.out.println("hello");}}
// Inner i=new Inner();
// i.show();}}
// class InnerClass{
// public static void main(String[] args) {
// Outer o=new Outer();
// o.display();
// }
// }
// ANONYMOUS OBJECT//
// abstract class My{
// abstract public void show();}
// class Outer{
// public void display(){
// new My() {
// public void show(){System.out.println("hello");}}.show();
// // m.show();
// }}
// class InnerClass{
// public static void main(String[] args) {
// Outer o=new Outer();
// o.display();
// }
// }
// // DEMO INTERFACE//
// interface My{
// public void show();}
// class Outer{
// public void display(){
// My m=new My() {
// public void show(){System.out.println("hello");}};
// m.show();
// }}
// class InnerClass{
// public static void main(String[] args) {
// Outer o=new Outer();
// o.display();
// }
// }
// STATIC INNER CLASS//
// class Outer{
// int x=10;
// static int y=20;
// static class Inner{
// public void display(){System.out.println(y);}}
// }
// public class InnerClass{
// public static void main(String[] args) {
// Outer.Inner m=new Outer.Inner();
// m.display();
// }
// }