SHARE
TWEET

Untitled

a guest Feb 26th, 2020 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top