Q. Predict the output?

Code:
// file name: Main.java
public class Main {
    public static void main(String args[]) {
       int arr[] = {10, 20, 30, 40, 50};
       for(int i=0; i < arr.length; i++)
       {
             System.out.print(" " + arr[i]);              
       }
    }
}
  • (A) 10 20 30 40
  • (B) 10 20 30 40 50
  • (C) Compiler Error
  • (D) Runtime Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 10 20 30 40 50

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

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