Boolean arithmetic expression - Java Language Basics

Java examples for Language Basics:boolean

Description

Boolean arithmetic expression

Demo Code

public class Main {
  public static void main(String[] args) {
    boolean b1 = (6 - 2) == 4;
    boolean b2 = 22 / 7 == 3 + 1 / 7.0;
    boolean b3 = 22 / 7 == 3 + 1 / 7;
    System.out.println(b1); // true
    System.out.println(b2); // false
    System.out.println(b3); // true
  }/*from  w w w.j a  v a 2  s .c  o  m*/
}

Result


Related Tutorials