SCJP題庫第186題

 
Two statements are true about the hashCode method? (Choose two.)
A. The hashCode method for a given class can be used to test for object equality and object inequality for that class.
B. The hashCode method is used by the java.util.SortedSet collection class to order the elements within that set.
C. The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.
D. The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.
E. The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

Ans: CE

解說:
hashCode方法
The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.
雜湊值可用在測試物件的不等性,不能用來測試物件的相等性(因為雜湊值不同,物件必不同,湊值一樣,物件未必一樣,因為不同的物件有可能雜湊值一樣)
The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.
hashCode方法被java.util.HashSet collection類別用來將元素以雜湊槽方式聚集起來以迅速取出物.

Comments

Popular posts from this blog

Android-使用webview在V3版的Google地圖GPS定位