Home | History | Annotate | Download | only in differentiate_dot_expressions
      1 public class FieldDotExpressions {
      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();
     11     public String firstContainerMethod() {
     12         return "firstContainerMethod()";
     13     }
     14     public String secondContainerMethod() {
     15         return "secondContainerMethod()";
     16     }
     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