欢迎来到PP题库网 PP题库官网
logo
全部科目 > Oracle认证考试 > OCJP(310-065)

多项选择题

Given a pre-generics implementation of a method:

What three changes allow the class to be used with generics and avoid an unchecked warning?()

    A.Remove line 14.
    B.Replace line 14 with "int i = iter.next();".
    C.Replace line 13 with "for (int i : intList) {".
    D.Replace line 13 with "for (Iterator iter : intList) {".
    E.Replace the method declaration with "sum(List intList)".


点击查看答案

相关考题

  • 单项选择题
    Given: Which method will complete this class?()

    A.public int compareTo(Object o){/*more code here*/}
    B.public int compareTo(Score other){/*more code here*/}
    C.public int compare(Score s1,Score s2){/*more code here*/}
    D.public int compare(Object o1,Object o2){/*more code here*/}

  • 多项选择题
    WhichtwostatementsaretrueaboutthehashCodemethod?()

    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 objecte quality, 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.

  • 单项选择题
    Given: Which statement is true?()

    A.The equals method does NOT properly override the Object.equals method.
    B.Compilation fails because the private attribute p.name cannot be accessed in line 5.
    C.To work correctly with hash-based data structures,this class must also implement the hashCode method.
    D.When adding Person objects to a java.util.Set collection,the equals method in line 4 will prevent duplicates.


微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题