What is the output of the following code? public class ex { public static void…
PYQ RPSC Programmer 2024
What is the output of the following code? public class ex { public static void main(String[] args) { int[] a = {1, 2, 3, 4, 5}; print(a); } public static void print(int[] a) { for(int n : a) { System.out.print(n + " "); } } }
- A.
Compilation error
- B.
5 4 3 2 1
- C.
Runtime error
- D.
1 2 3 4 5
- E.
Question not attempted
Attempted by 284 students.
Sign up free to check your answer
Sign up freeLoading lesson…

