1 Reply Latest reply on Sep 6, 2017 6:57 PM by morgalr

    Why do my outputs produce nothing but false?

    Sergio1234

      /////////////////////////////////////////////////////

      package Test;

       

      class Outer

      {

      private Inner variable = new Inner();

       

      class Inner

      {

      Inner()

      {}

      }

       

      Outer()

      {}

       

      Inner getInner()

      {

      return variable;

      }   

      }

      /////////////////////////////////////////////////////

      package Test;

       

      import static java.lang.System.*;

       

      public class Test {

       

        

          public static void main(String ...args)

          {

             Outer outer = new Outer();

             

             Outer.Inner inner = outer.getInner();

            

             out.println(outer.getClass().isAnonymousClass());

            

             out.println(outer.getClass().isSynthetic());

            

             out.println(inner.getClass().isAnonymousClass());

            

             out.println(inner.getClass().isSynthetic());

            

             out.println(Outer.class.isAnonymousClass());

            

             out.println(Outer.Inner.class.isAnonymousClass());

            

             out.println(Outer.class.isSynthetic());

            

             out.println(Outer.Inner.class.isSynthetic());

          }

      }

      /////////////////////////////////////////////////////