Challenge for Maps


Create a Phonebook program that lets you quickly add and lookup names and numbers (both Strings).

The phonebook should implement the following two methods:

  • void putNumber(String name, String number) -Adds an entry to the phonebook.
  • String getNumber(String name) - Returns the phone number of a given name or null if the name is not present.

The boilerplate below includes the sample data that will be added and printed from the phonebook.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Contact Us
Sign in or email us at [email protected]