forked from learning-zone/java-basics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNestedClasses.java
More file actions
23 lines (18 loc) · 482 Bytes
/
NestedClasses.java
File metadata and controls
23 lines (18 loc) · 482 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package interfaces;
class OuterClass {
static int outer_x = 10;
int outer_y = 20;
private static int outer_private = 30;
static class StaticNestedClass {
void display(){
System.out.println("outer_x = " + outer_x);
System.out.println("Outer_private = " + outer_private);
}
}
}
public class NestedClasses {
public static void main(String[] args) {
OuterClass.StaticNestedClass nestedObject = new OuterClass.StaticNestedClass();
nestedObject.display();
}
}