|
problem with logical operators
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
int switch1 = 10;
int switch2 = 20;
}
if(((switch1==1)&&(switch2==-1))||((switch1!=1)&&(switch2!=-1)))
JOptionPane.showMessageDialog (null, "Trouble, the switches are the same!");
else
JOptionPane.showMessageDialog(null, "Ok the switches are different.");
}
}
}
The problem here is that the compiler keeps on saying that I need a bracket. Alternately, I add one, and the whole code just...is awash in red lines. Help?
Last edited by dannyboi; 08-12-2012 at 03:09 AM..
|