Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashMap;
- import java.util.Scanner;
- import javax.swing.*;
- public class test {
- public static void main( String args []){
- HashMap<String, Integer> phonebook = new HashMap<>();
- int counter = 0;
- while(true){
- Scanner text = new Scanner(System.in);
- System.out.print("Enter you phonebook");
- String value1 = text.nextLine();
- if(value1.equals("Display")){
- System.out.print(phonebook);
- }else{
- phonebook.put(value1, counter++);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement