...

/

Solution Review: Compute an Expression Using Logic

Solution Review: Compute an Expression Using Logic

In this review, the solution of the challenge 'Compute an expression using logic' from the previous lesson is provided.

Solution: Is it true or false?

Press + to interact
class HelloWorld {
public static void main( String args[] ) {
boolean x = true;
boolean y = true;
boolean answer;
boolean not_x = !x;
boolean xor_x = not_x ^ x;
boolean and_xy = xor_x && y;
answer = !and_xy;
System.out.println(answer);
}
}
...