Java Boolean Logical Operators Question 2

Question

What is the output of the following code?

public class Main {
  public static void main(String[] args) {
    int x = 1;/*from w w  w  . j  ava2  s  .c o  m*/
    System.out.println((true) && (3 > 4));
    System.out.println(!(x > 0) && (x > 0));
    System.out.println((x > 0) || (x < 0));
    System.out.println((x != 0) || (x == 0));
    System.out.println((x >= 0) || (x < 0));
    System.out.println((x != 1) == !(x == 1) );
  }
}


false
false
true
true
true
true



PreviousNext

Related