Question: Q 6 ( Sets and Maps ) : Consider the following Map in Java: Map myMap = new HashMap ( ) ; ( a )
QSets and Maps:
Consider the following Map in Java:
Map myMap new HashMap;
a Would your Book class need to implement the hashCode function for the above map? Why or why not?
b You are given an array of Strings, as: String myNames. This is to be treated as an array of keys into the map. Write a short piece of code, that for each of these keys in myNames, gets the corresponding book from the map, and prints the book.
c Book is a user class. If you do: System.out.printlnbk where bk is an object of Book, what function does java call of the Book class to print bk
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
