-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatic_usage_II.java
More file actions
49 lines (41 loc) · 1.19 KB
/
static_usage_II.java
File metadata and controls
49 lines (41 loc) · 1.19 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
import java.util.*;
import java.io.*;
class Outer{
public int x;
public static int y;
public static void fun(){
System.out.println("you are in fun function");
System.out.println("value of y:"+y);
}
static class inner{
public int x2;
public static int y2;
public void fun2(){
System.out.println("i am in fun2");
fun();
}
static class inner2{
public int x2;
public static int y2;
public void fun3(){
System.out.println("i am in inside inner class");
fun();
}
public static void hello(){
System.out.println("Helloo Hello");
}
}
}
}
public class static_usage_II {
public static void main(String[] args) {
Outer obj1=new Outer();
Outer.inner obj2=new Outer.inner();
// Outer.inner2 obj3=new Outer.inner2();
Outer.inner.inner2 obj3=new Outer.inner.inner2();
Outer.inner.inner2.hello(); ////this you can do when the function is static
// obj.fun();
// obj2.fun2();
// obj3.hello();
}
}