What will be the output of the following program?

import java.util.HashMap;
import java.util.Map;

public class Program {
public static void main(String... args) {
Key k1 = new Key();
Key k2 = new Key();

Map map = new HashMap<>();

map.put(k1, "value1");
map.put(k2, "value2");

System.out.println(map.get(k1));
System.out.println(map.get(k2));
}
}

class Key {
public boolean equals(Object o) {
return true;
}
public int hashCode() {
return 1;
}
}

a. value2
value2
b. null
null
c. value1
value2
d. A Runtime Exception will be thrown.


a. value2
value2

Computer Science & Information Technology

You might also like to view...

MC Each module’s global namespace contains an identifier called______that states the module’s name.

a) (name). b) _name_. c) __name__. d) None of the above.

Computer Science & Information Technology

Stream mutable reduction operation ________ creates a new collection of elements containing the results of the stream’s prior operations.

a. combine b. accumulate c. gather d. collect

Computer Science & Information Technology

In general, you begin most modifications by _____ the chart element you want to change.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

If you want to separate the field "Beginning to Ending Inventory," which is currently a range of two numbers, to two different fields, your first step should be to:

A) change the primary key. B) insert a field. C) click the "Separate field" button. D) delete the field.

Computer Science & Information Technology