title: Logical expressions in java
body: <p>So on Java , an "AND" statement is &amp;&amp;, "OR" statement is ||...</p>
  
  <p>What about for XOR then... that is if I have two choices. I HAVE to pick one, but I can't pick both. </p>
  
  <p>HOWEVER, </p>
  
  <pre><code>private class CheckBoxListener implements ItemListener{
      public void itemStateChanged(ItemEvent e)
      {
      if(one.isSelected()^two.isSelected()){
  
      thehandler handler = new thehandler();
      button.addActionListener(handler);
  
          }   
  
   }}
  </code></pre>
  
  <p>Even if I have both checkboxes selected, the button is 'enabled'. This is the handler for the button fyi:</p>
  
  <pre><code>private class thehandler implements ActionListener{
          public void actionPerformed(ActionEvent event){
  
      dispose();
  }
  </code></pre>
  
  <p>So if both are selected, and If i click the button. the frame should not dispose. It should only dispose when either one of them is selected. </p>