Java Arithmetic Operator divide two integer

Question

What is the output of the following code?


public class Main {
  public static void main(String args[]) {
    int a = 1;/*from www . j  ava2  s . c o m*/
    int b = 2;

    double d = a / b;

    System.out.println(d);
  }
}


0.0

Note

When two integer values division will not keep the decimal values.




PreviousNext

Related