• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 public class FieldDotExpressions {
main(String[] args)2     public static void main(String[] args) {
3         InnerClassFieldContainer.outerField.containerField.containerField.firstContainerMethod();
4         InnerClassFieldContainer.InnerClass.innerField.containerField.containerField.secondContainerMethod();
5         InnerClassFieldContainer.InnerClass.InnerInnerClass.InnerInnerInnerClass.innerInnerInnerField.thirdContainerMethod();
6     }
7 }
8 
9 class FieldContainer {
10     FieldContainer containerField = new FieldContainer();
firstContainerMethod()11     public String firstContainerMethod() {
12         return "firstContainerMethod()";
13     }
secondContainerMethod()14     public String secondContainerMethod() {
15         return "secondContainerMethod()";
16     }
thirdContainerMethod()17     public String thirdContainerMethod() {
18         return "thirdContainerMethod()";
19     }
20 }
21 
22 class InnerClassFieldContainer {
23     FieldContainer outerField = new FieldContainer();
24     class InnerClass {
25         FieldContainer innerField = new FieldContainer();
26         class InnerInnerClass {
27             FieldContainer innerInnerField = new FieldContainer();
28             class InnerInnerInnerClass {
29                 FieldContainer innerInnerInnerField = new FieldContainer();
30             }
31         }
32     }
33 }
34