Java Arithmetic Operator Question 3

Question

What is the output of the following code?

System.out.println(2 * (5 / 2 + 5 / 2)); 
System.out.println(2 * 5 / 2 + 2 * 5 / 2); 
System.out.println(2 * (5 / 2)); 
System.out.println(2 * 5 / 2); 


8
10
4
5

Note

public class Main {
  public static void main(String[] args) {
    System.out.println(2 * (5 / 2 + 5 / 2));
    System.out.println(2 * 5 / 2 + 2 * 5 / 2);
    System.out.println(2 * (5 / 2));
    System.out.println(2 * 5 / 2);
  }//w w w .j  a  v a  2  s  .  com
}



PreviousNext

Related