title: I've been doing for java server and client, is there any way stop avoid this kind of error and start the menu again?
body: <blockquote>
  <pre><code>=========Menu Bagian Server=========
  1. Start Server
  2. server room
  2. Exit
  =============================================
  Masukkan Pilihan: masukkan angka! 
  
  Exception in thread &quot;main&quot; java.util.NoSuchElementException: No line found
    at java.base/java.util.Scanner.nextLine(Scanner.java:1651)
    at com.company.Server.menuServer(Server.java:35)
  </code></pre>
  <p>at com.company.Server.main(Server.java:17)</p>
  <p>Process finished with exit code 1</p>
  </blockquote>
  <p>here is the code, how to make the menu loop again so i can start the server after it terminated</p>
  <pre><code>public static void serverRoom() throws IOException{
     din = new DataInputStream(s.getInputStream());
     dout = new DataOutputStream(s.getOutputStream());
      try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
          String str = &quot;&quot;, str2;
          while (!str.equalsIgnoreCase(&quot;Exit&quot;)) {
              str = din.readUTF();
              System.out.println(&quot;client says: &quot; + str);
              str2 = br.readLine();
              dout.writeUTF(str2);
              dout.flush();
          }
          din.close();
          s.close();
          ss.close();
      }
  </code></pre>