Q. What is the output of the following code?
Code:
double x = 5; double y = 3; System.out.println(x / y);
β
Correct Answer: (B)
1.67
Explanation: When dividing two doubles in Java, the result is a double. In this case, the division of 5.0 by 3.0 is equal to 1.6666666666666667, which is printed to the console.