public class Alpha{
      private int iam;
      boolean isEqualTo(Alpha anotherAlpha)
      {
       if (this.iam==anotherAlpha.iam) return true;
       else return false;  
      }
      
      public static void main( String[] args )
      {
        Alpha a1 = new Alpha();
        Alpha a2 = new Alpha();
        System.out.println( a1.isEqualTo( a2 ) );
      } 
         
}返回true

解决方案 »

  1.   

    哈哈 大意了 
    本来是学true的 既然写了false 
      

  2.   

    昨天又想了一下,今天给你回复。这样总是返回true,不知道你的程序的本意是不是这样,
    public class Alpha{
          private static int iam; // NOTE:static        boolean isEqualTo(Alpha anotherAlpha)
          {
           if (this.iam==anotherAlpha.iam) return true;
           else return false;  
          }
          
          public static void main( String[] args )
          {
           Alpha a1 = new Alpha();
           Alpha a2 = new Alpha();
           System.out.println( a1.isEqualTo( a2 ) );
          } 
             
    }
      

  3.   

    public class Alpha{
          private int iam; // NOTE:static        boolean isEqualTo(Alpha anotherAlpha)
          {
           if (this.iam==anotherAlpha.iam) return true;
           else return false;  
          }
          
          public static void main( String[] args )
          {
           Alpha a1 = new Alpha();
           a1.iam = 1;
           Alpha a2 = new Alpha();
           a2.iam = 2;
           System.out.println( a1.isEqualTo( a2 ) );
          } 
             
    }