当前位置: 代码迷 >> Java相关 >> [求助]谁知道这个问题的答案!!!
  详细解决方案

[求助]谁知道这个问题的答案!!!

热度:89   发布时间:2005-10-04 18:30:00.0
[求助]谁知道这个问题的答案!!!
1. Given: Integer i = new Integer (42); Long 1 = new Long (42); Double d = new Double (42.0); Which two expressions evaluate to True? A. (i == 1) B. (i == d) C. (d == 1) D. (i.equals (d)) E. (d.equals (l)) F. (i.equals (42)) 2.

Which statement is true?

A. An anonymous inner class may be declared as final

B. An anonymous inner class can be declared as private

C. An anonymous inner class can implement multiple interfaces

D. An anonymous inner class can access final variables in any enclosing scope

E. Construction of an instance of a static inner class requires an instance of the enclosing outer class.

[此贴子已经被作者于2005-10-4 19:32:01编辑过]


----------------解决方案--------------------------------------------------------
我想是F
----------------解决方案--------------------------------------------------------
第一题我也觉得是F
第二题我就不大懂了。。。请高手指点了 。或者自己查找资料。。也行
----------------解决方案--------------------------------------------------------
第一题是:c、d
第二题是:a
----------------解决方案--------------------------------------------------------
哇 好阴险,那个Long 1 =... 居然是数字1, 而不是字母l。
大家怎么得出答案的,说说理由好不好??
(好老的帖啊,10月份的...)
----------------解决方案--------------------------------------------------------

第一题是F


----------------解决方案--------------------------------------------------------

第一题:none
第二题:e


----------------解决方案--------------------------------------------------------
import java.lang.*;
class AA{
public static void main(String[] args){
Integer i = new Integer(42);
Long l = new Long(42);
Double d = new Double(42.0);
//System.out.println("i==l:" + i==l);
//System.out.println("i==d:" + i==d);
//System.out.println("d==l:" + d==l);
System.out.println("i.equals(d):" + i.equals(d));
System.out.println("d.equals(l):" + d.equals(l));
System.out.println("i.equals(42):" + i.equals(42));
}
}
刚刚运行了一下~~
是:F
注意理解引用了~
----------------解决方案--------------------------------------------------------
==代表是不是同一个对象,及是不是指向同一个内存地址
equals代表的是不是相同的内容
----------------解决方案--------------------------------------------------------
  相关解决方案