class Outer{ public static void main(String[] args){ new Inner(); } class Inner { Inner() {} } }
Inner
Outer
main()
public
static class Outer{ public static void main(String[] args){ // } private class Inner{ Inner() {} } }
static
private
final
class Outer { String s1 = "Java"; String s2 = "2"; public static void main(String[] args) { Outer outer = new Outer(); } Outer() { Inner inner = new Inner(); } class Inner { String s1 = "Certification"; String s2 = "Exam"; Inner() { System.out.println(Outer.this.s1); System.out.println(this.s1); System.out.println(s2); } } }
class OuterInnerStatic { static String s1 = "Java"; static String s2 = "2"; public static void main(String[] args) { Inner inner = new Inner(); } static class Inner { String s1 = "Certification"; String s2 = "Exam"; Inner() { System.out.println(OuterInnerStatic.s1); System.out.println(this.s1); System.out.println(s2); } } }
Outer.s1
Outer.this.s1
abstract
native
synchronized
Object