title: How to add if statements to JOptionPane
body: <p>I am trying to make a game for a project and I need help. I created a dialog box where the user is presented with two options. They can chose to "Use the car" or they can chose to "walk". How do I code further so that after they chose an option, something happens. For example, if they chose "Use the car" it will return "good choice" whereas if they chose "walk" it will return "bad choice".</p>
  
  <pre><code>public void travel ()
  {
    Object [] options = { "Use the car", "Walk" };
    JOptionPane.showOptionDialog(null, //Component parentComponent
                             "How do you want to get to Jim's?", //Object message,
                             "Transportation Method", //String title
                             JOptionPane.YES_NO_OPTION, //int optionType
                             JOptionPane.INFORMATION_MESSAGE, //int messageType
                             null, options, options [0]); //Icon icon, 
   if(options == 0 ){
   System.out.println ("Test Option 1");//Use car was chosen
  }else{
  System.out.println ("Test Option 2");//Walk was chosen
  }
  }
  </code></pre>
  
  <p>This is my code so far but I receive an error message "Error: incomparable types: java.lang.Object[] and int".</p>
  
  <p>I would really appreciate your help. Thanks in advance</p>