title: Switch case repeat after a case was chosen and executed
body: <p>I am new to programming and I was trying to implement HashMaps using Switch case where user selects an option and adds or removes keys. If user selects option 1, which inserts the Key-Value pair, the program ends after that and I dont get to choose other options which allows user to display the key set etc. I want to program to continue to execute after a successful case was executed. Sorry for my bad english.</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.util.HashMap;
  
  
  public class HashMapImplementation {
      public static void main(String args[]) throws Exception {
          HashMap&lt;String, String&gt; hashMap = new HashMap&lt;String, String&gt;();
          BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  
  
          System.out.println("Please select what you want to do:");
          System.out.println("1. Add Key-Value to HashMap ");
          System.out.println("2. Delete Key-Value from HashMap ");
          System.out.println("3. Display all Keys");
          System.out.println("4. Display all Values");
          System.out.println("5. Display Key-Value Set");
          System.out.println("6. Find a Value in HashMap");
          int c = Integer.parseInt(reader.readLine());
          switch (c) {
              case 1:
                  System.out.println("Please enter the Key:");
                  String key = reader.readLine();
                  System.out.println("Please enter the value:");
                  String value = reader.readLine();
  
                  if (hashMap.containsKey(key)) {
                      System.out.println("The key you entered already exists in the HashMap. Would you like to overwrite it?(Y/N)");
                      String overwrite = reader.readLine();
                      if (overwrite == "y") {
                          hashMap.put(key, value);
                          System.out.println("Key: " + key + " and Value: " + value + " Inserted successfully!");
                          break;
                      } else {
                          System.out.println("No value entered");
                          break;
                      }
  
                  }
  
                  hashMap.put(key, value);
                  System.out.println("Key: " + key + " and Value: " + value + " Inserted successfully!");
                  break;
  
  
              case 2:
                  System.out.println("Please enter the Key you want to remove from HashMap:");
                  key = reader.readLine();
                  if (hashMap.containsKey(key)) {
                      hashMap.remove(key);
                      System.out.println("Key: " + key + " was successfully removed from HashMap");
                      break;
                  } else {
                      System.out.println("The key you entered doesnt exist in HashMap");
                      break;
                  }
  
              case 3:
                  System.out.println();
                  hashMap.keySet();
                  break;
  
              case 4:
                  System.out.println();
                  hashMap.values();
                  break;
  
              case 5:
                  System.out.println();
                  hashMap.toString();
                  break;
  
              case 6:
                  System.out.println("Please enter the key for the value you want to look up in the HashMap");
                  key = reader.readLine();
                  if (hashMap.containsKey(key)) {
                      hashMap.remove(key);
                      System.out.println("Key: " + key + " was successfully removed from HashMap");
                      break;
                  } else {
                      System.out.println("The key you entered doesnt exist in HashMap");
                      break;
                  }
  
              default:
                  System.out.println("Please enter numbers between 1 and 6 from the list of options!");
  
          }
      }
  }
  </code></pre>