只有b,e对,
a, 错 对象与基本类型不能用==
b, 对 自己等于自己当然多
c, 错 两个对象只有地址相同才相等==
d: 错 equals的参数应该是对象
f: 对 
e: 错 equals的参数应该是对象

解决方案 »

  1.   

    这好像是上周我考试的一道题,不过好像你写得不全。这样一来只有B了。
    ==必须两边的类型一样,所以A,C都不可能。equals()需要Object 为参数,D,F又错了。E可以编译成功,但返回FALSE。所以只有B。
      

  2.   

    补充一句,==是地址的比较。
    To zych72(闹闹)
    F对吗?它的确可以编译通过,可怎么可能返回True呢?
      

  3.   

    e也不对,因为Dougle.equals()要检查类型是Double且数值相等
    Compares this object against the specified object. The result is true if and only if the argument is not null and is a Double object that represents a double that has the identical bit pattern to the bit pattern of the double represented by this object. For this purpose, two double values are considered to be the same if and only if the method doubleToLongBits(double) returns the same long value when applied to each
      

  4.   

    无论是g.equals(d)还是d.equals(g)都是错误的1equals比较的是对象,相等的条件是数据类型和值都相等!