title: Calculator in java displays double instead if int
body: <p>Hey guys i am building a java calculator and everything works fine except the fact that i am doing calculations with double numbers. </p>
  
  <p>The problem is that when i want to do 0.3 + 0.5 = 0.8 works fine, but when i do 6 + 6 = 12.0 </p>
  
  <p>How can i fix this so when the result is .0 at the end it displays an integer?</p>
  
  <p>My code is:</p>
  
  <pre><code>public void actionPerformed(ActionEvent e) {
                  int j = 0;
                  r2 = Double.parseDouble(textField.getText());
                  if (option.equals("+")) {
                      result = r1 + r2;
                  }
                  if (option.equals("-")) {
                      result = r1 - r2;
                  }
                  if (option.equals("*")) {
                      result = r1 * r2;
                  }
                  if (option.equals("/")) {
                      result = r1 / r2;
                  }
                  textField.setText(result + " ");
              }
  </code></pre>