title: java class, exception, user input
body: <p>I have a driven menu class using switch and beside that a class, that class throws an exception when a wrong input is entered how can I got back after the exception and ask the user to input data again.</p>
  
  <p>java class diamond:</p>
  
  <pre><code>public class Diamond 
  {
  
  private int x;
  
      public Diamond(int x) throws IllegalArgumentException 
      {
          if ((x % 2) == 0) 
          {
             System.out.println("\nx must be odd.");
             throw new IllegalArgumentException("x must be odd.");
  
          }
        this.x = x;
  
      }
  </code></pre>