title: How to convert String "7/7" to Int 1?
body: <p>I'm trying to make a calculator GUI in Java, however I can't figure out how to convert "7/7" into a double.</p>
  
  <p>I've tried converting it directly into a double, but I can't get it to work.</p>
  
  <pre class="lang-java prettyprint-override"><code>private class handler implements ActionListener{
  
      String answerString = "";
      int answerDouble;
  
      public void actionPerformed(ActionEvent e) {
  
          if(e.getSource() == clear) {
              answerString = "";
              result.setText(answerString);
          }
          if(e.getSource() == openBracket) {
              answerString = answerString + "(";
              result.setText(answerString);
          }
          if(e.getSource() == closeBracket) {
              answerString = answerString + ")";
              result.setText(answerString);
          }
          if(e.getSource() == divide) {
              answerString = answerString + "/";
              result.setText(answerString);
          }
          if(e.getSource() == seven) {
              answerString = answerString + "7";
              result.setText(answerString);
          }
          if(e.getSource() == equal) {
              answerDouble = Integer.parseInt(answerString);
              answerString = Double.toString(answerDouble);
              result.setText(answerString);
          }
      }
  
  }
  </code></pre>
  
  <p>It should display 1 for 7/7 but instead outputs an error on the command line.</p>