title: Java Multiplying 2 integers from strings
body: <p>I've tried searching a number of threads in terms of multiplying 2 strings. However, it seems that most of the links I found weren't applicable or I couldn't interpret them well enough. </p>
  
  <p>Would it be possible if could tell me what is wrong with my current code?</p>
  
  <pre><code>public static void main(String[] args) {
  
      String sample = value1();
      String sample2 = value2();
              //========== Test if users placed any characters within the boxes =========\\
              try {
                  Integer.parseInt(sample);
              } catch (NumberFormatException e) {
                  System.out.println("System detects that you are using characters");
                  return;
              }
              try {
                  Integer.parseInt(sample2);
              } catch (NumberFormatException e) {
                  System.out.println("System detects that you are using characters");
                  return;
              }
       Integer.parseInt(sample); 
       Integer.parseInt(sample2);
      System.out.println("The total multiplication that you have inserted is "+sample * sample2+ ".");
  }
  
  public static String value1() { //obtain first user input. 
  
      String sample = JOptionPane.showInputDialog(null, "Insert Value", "Enter amount ", JOptionPane.QUESTION_MESSAGE);
      if (sample.isEmpty()) {
  
          JOptionPane.showMessageDialog(null, "Error!", "No Value Detected", JOptionPane.ERROR_MESSAGE);
          sample = value1();
  
  
      }
      return sample;
  
  }
  
  public static String value2() { //obtain second user input. 
  
      String sample2 = JOptionPane.showInputDialog(null, "Insert Value", "Enter amount ", JOptionPane.QUESTION_MESSAGE);
      if (sample2.isEmpty()) {
  
          JOptionPane.showMessageDialog(null, "Error!", "No Value Detected", JOptionPane.ERROR_MESSAGE);
          sample2 = value2();
  
  
      }
      return sample2;
  
  }    
  </code></pre>
  
  <p>}</p>
  
  <p>My final output should multiply the following numbers</p>
  
  <p><code>System.out.println("The total multiplication that you have inserted is "+sample * sample2+ ".");</code></p>