1 / 5
文档名称:

java笔试题07.doc

格式:doc   大小:43KB   页数:5
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

java笔试题07.doc

上传人:mh900965 2018/3/3 文件大小:43 KB

下载得到文件列表

java笔试题07.doc

相关文档

文档介绍

文档介绍:1. Given the following,
11. x = 0;
12. if (() != () ) x = x + 1;
13. if ((x4) ) x = x + 10;
14. if (!(x6) ) x = x + 100;
15. if (() == () ) x = x + 1000;
16. ("x = " + x);
and assuming that the equals () and hashCode() methods are property implemented, if the output is “x = 1111”, which of the following statements will always be true?
A. (x1)
B. () == ()
C. () != ()
D. (x7)
2. Given the following,
class Test1 {
public int value;
public int hashCode() { return 42; }
}
class Test2 {
public int value;
public int hashcode() { return (int)(value^5); }
}
which statement is true?
A. class Test1 will pile.
B. The Test1 hashCode() method is more efficient than the Test2 hashCode() method.
C. The Test1 hashCode() method is less efficient than the Test2 hashCode() method.
D. class Test2 will pile.
E. The two hashcode() methods will have the same efficiency.
3. Which two statements are true paring two instances of the same class, given that the equals() and hashCode() methods have been properly overridden? (Choose two.)
A. If the equals() method returns true, the hashCode() comparison == must
return true.
B. If the equals() method returns false, the hashCode() comparison != must return
true.
C. If the hashCode() compar