.Given the following fragment of code:
Double d1 = new Double(1.0);
Double d2 = new Double(1.0);
Float f = new Float(1.0F);
Which results of the following expressions are true?
A. d1 == d2
B. d1.equals(d2)
C. d1 = f
D. f.equals(d1)
...全文
3411打赏收藏
这道题选什么????
.Given the following fragment of code: Double d1 = new Double(1.0); Double d2 = new Double(1.0); Float f = new Float(1.0F); Which results of the following expressions are true? A. d1 == d2 B. d1.equals(d2) C. d1 = f D. f.equals(d1)
//以下是关于Double的equals方法的描述。
public boolean equals(Object obj)
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 same value as the double represented by this object.