AllExam Dumps

DUMPS, FREE DUMPS, VCP5 DUMPS| VMWARE DUMPS, VCP DUMPS, VCP4 DUMPS, VCAP DUMPS, VCDX DUMPS, CISCO DUMPS, CCNA, CCNA DUMPS, CCNP DUMPS, CCIE DUMPS, ITIL, EXIN DUMPS,


READ Free Dumps For Oracle- 1z0-851





Question ID 3926

Given that the elements of a PriorityQueue are ordered according to natural ordering, and:
2.    import java.util.*;
3.    public class GetInLine {
4. public static void main(String[] args) {
5. PriorityQueue<String> pq = new PriorityQueue<String>();
6. pq.add("banana");
7. pq.add("pear");
8. pq.add("apple");
9. System.out.println(pq.poll() + " " + pq.peek());
10. }
11. }
What is the result?
 

Option A

A.    apple pear
 

Option B

B.    banana pear
 

Option C

C.    apple apple
 

Option D

D.    apple banana
 

Option E

E.    banana banana
 

Correct Answer D
Explanation


Question ID 3927

Given:
11. public class Person {
12. private String name, comment;
13. private int age;
14. public Person(String n, int a, String c) {
15. name = n; age = a; comment = c;
16. }
17. public boolean equals(Object o) {
18. if (! (o instanceof Person)) return false; 19, Person p = (Person)o;
20.    return age == p.age && name.equals(p.name);
21.    }
22.    }
What is the appropriate definition of the hashCode method in class Person?
 

Option A

A.    return super.hashCode();
 

Option B

B.    return name.hashCode() + age * 7;
 

Option C

C.    return name.hashCode() + comment.hashCode() / 2;
 

Option D

D.    return name.hashCode() + comment.hashCode() / 2 - age * 3;
 

Correct Answer B
Explanation

Send email to admin@getfreedumps for new dumps request!!!