Java Arithmetic Operator calculate floating point value

Question

What is the output of the following code?


public class Main { 
  public static void main(String[] args) { 
    System.out.println((10.5 + 2 * 3) / (45 - 3.5));
  }
}


0.39759036144578314

Note

When floating point type is involved in calculation we cannot get exact result.




PreviousNext

Related