First off '=' assigns a variable to the right operand of the equal sign
, it does not test for equality. Use the equality operator ==
in your if statements.
Second, you don't need two if-statements.
variables can be used as true or false expressions
Fouth, it is bad programming practice to use those exits in if-statements. The code will naturally break off the if block.
Fifth, you can actually print the variable itself for a true or false string.
System.out.println(x); //prints true if x is true
System.out.println(x); //prints false if x is false