« Conditionals and loops

Relational logical operators

1int a = 10, b = 10;
2System.out.println(a > b);
3System.out.println(a < b);
4System.out.println(a == b);
5System.out.println(a != b);
6System.out.println(a >= b);
7System.out.println(a <= b);
8
9System.out.println(a >= 10 && b > 10);
10System.out.println(a >= 10 || b > 10);
11
12System.out.println(!(a > b));

If condition

1Scanner s = new Scanner(System.in);
2int c, d;
3c = s.nextInt();
4d = s.nextInt();
5if (c > d) {
6 System.out.println("First num is greater");
7} else {
8 System.out.println("Second num is greater");
9}