Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import java.util.HashMap;
  2. import java.util.Scanner;
  3.  
  4. import javax.swing.*;
  5.  
  6. public class test {
  7.  
  8.  
  9. public static void main( String args []){
  10. HashMap<String, Integer> phonebook = new HashMap<>();
  11.  
  12.  
  13. int counter = 0;
  14. while(true){
  15. Scanner text = new Scanner(System.in);
  16. System.out.print("Enter you phonebook");
  17. String value1 = text.nextLine();
  18. if(value1.equals("Display")){
  19. System.out.print(phonebook);
  20. }else{
  21. phonebook.put(value1, counter++);
  22. }
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement