Your program uses a Map structure to store a number of user ids and corresponding email addresses. Although each user must have a unique id, two or more users can share the same email address. Select an appropriate expression to complete the method below, which adds a new id and email address to the map only if the id is not already in use. If the id is already in use, an error message is printed. public static void addUserID(Map<String, String> users, String id, String email)
{
String currentEmail = users.get(id) ;
If (___________________)
{
Users.put(id, email) ;
}
Else
{
System.out.println(id + " is already in use.") ;
}
}
A) currentEmail.equals(email)
B) !currentEmail.equals(email)
C) currentEmail == null
D) currentEmail != null
Correct Answer:
Verified
Q70: Assume that you have declared a map
Q71: You want to enumerate all of the
Q72: You need to write a program to
Q73: You need to access values in the
Q74: Which of the following statements about manipulating
Q76: You need to access values using a
Q77: You need to access values by their
Q78: Consider the following code snippet:
Map<String, Integer> scores;
If
Q79: Assume that you have declared a map
Q80: Which of the following algorithms would be
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents