πŸ“Š JAVA
Q. What is output of the following code:
public class Test{
public static void main(String[] args){
int[] x = {120, 200, 016 };
for(int i = 0; i < x.length; i++)
System.out.print(x[i] + " ");
}
}
  • (A) 120 200 16
  • (B) 120 200 14
  • (C) 120 200 016
  • (D) 016 is a compile error. It should be written as 16.
πŸ’¬ Discuss
βœ… Correct Answer: (B) 120 200 14

Explanation: 016 is an octal number. The prefix 0 indicates that a number is in octal.

Explanation by: Bhagwan Das
016 is an octal number. The prefix 0 indicates that a number is in octal.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
95
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Bhagwan Das
Publisher
πŸ“ˆ
80%
Success Rate