Q. What is the output of the below Java program?

Code:
int balls[], rounds=3;
balls = new int[rounds];
for(int i=0; i<balls.length; i++)
    balls[i] = (i+1)*2;
for(int j=0; j<balls.length; j++)
    System.out.print(balls[j] + ",");
  • (A) 0,2,4,
  • (B) 1,2,3,
  • (C) 2,4,6,
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 2,4,6,

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
521
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
80%
Success Rate