title: JOptionPane Cannot Find Symbol
body: <p>I am trying to create a simple calculator using JOptionPane. I have encountered compiling errors.</p>
  
  <pre><code>import javax.swing.JOptionPane; 
  
  public class Calculator { 
    public static void main ( String args[] ) {
  
  
       double n1 = Double.parseDouble(JOptionPane.showInputDialog(" Enter first number: "));
       double n2 = Double.parseDouble(JOptionPane.showInputDialog(" Enter second number: "));
       String x = JOptionPane.showInputDialog("Enter operator: ");
       double result;
  
       if (x == "+"){
           result = (n1 + n2);
             JOptionPane.showMessageDialog(n1, "+", n2,"=", result); 
             }
  
          else if (x == "-"){
           result = (n1 - n2); 
             JOptionPane.showMessageDialog(n1,"-", n2,"=", result); 
             }
  
  
          else if (x == "/"){
              result = (n1 / n2);
              JOptionPane.showMessageDialog(n1,"/", n2,"=", result); }
          else if (n2 == 0){
                  JOptionPane.showMessageDialog(null, "Cannot divide by 0"); }
  
  
          else if (x == "*"){
              result = (n1 * n2); 
              JOptionPane.showMessageDialog(n1,"*", n2,"=", result); }
  
  
          else if (x == "%"){
                 result = (n1 % n2);
                 JOptionPane.showMessageDialog(n1,"%", n2,"=",(n1%n2)); }
    }
  }
  </code></pre>
  
  <p>My code brings up these compiling errors: </p>
  
  <p>5 errors found:
  File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java  [line: 14]
  Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:14: cannot find symbol
  symbol  : method showMessageDialog(double,java.lang.String,double,java.lang.String,double)
  location: class javax.swing.JOptionPane
  File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java  [line: 19]
  Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:19: cannot find symbol
  symbol  : method showMessageDialog(double,java.lang.String,double,java.lang.String,double)
  location: class javax.swing.JOptionPane
  File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java  [line: 25]
  Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:25: cannot find symbol
  symbol  : method showMessageDialog(double,java.lang.String,double,java.lang.String,double)
  location: class javax.swing.JOptionPane
  File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java  [line: 32]
  Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:32: cannot find symbol
  symbol  : method showMessageDialog(double,java.lang.String,double,java.lang.String,double)
  location: class javax.swing.JOptionPane
  File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java  [line: 37]
  Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:37: cannot find symbol
  symbol  : method showMessageDialog(double,java.lang.String,double,java.lang.String,double)
  location: class javax.swing.JOptionPane</p>