πŸ“Š JAVA
Q. What is the output of the following code?
Code:
double x = 5;
double y = 3;
System.out.println(x / y);
  • (A) 1
  • (B) 1.67
  • (C) 2
  • (D) 1.5
πŸ’¬ Discuss
βœ… 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.

Explanation by: Pushkar
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.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
440
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Pushkar
Publisher
πŸ“ˆ
86%
Success Rate