title: Parse String to Object in Java
body: <p>I created a project with 2 classes, Product and Stock. 
  Now I created a third class "Menu" to interact with my 2 classes. </p>
  
  <p>I'm using JOptionPane with the showInputDialog. 
  I'd like to get the input to the type "Product" from my self created class. </p>
  
  <p>I know there's a way to parse the input (String) to an Integer. </p>
  
  <pre><code>int keuze = Integer.parseInt(input);
  </code></pre>
  
  <p>So I'm searching an equivalent way to do this. </p>
  
  <pre><code> private void addNewProductType()
     {
          String input = JOptionPane.showInputDialog("Which product do you want to add?\n");
          stock.addNewProduct(input);
  
     }
  </code></pre>