Vidyalelo
Data Structure · Q197

Introduction to Data Structures

Programming · Data Structure · question 197

Q197

What is the output of the following Java code? public class array public static void main(String args[]) int []arr = 1,2,3,4,5; System.out.println(arr[2]); System.out.println(arr[4]);

A.
3 and 5
Answer
B.
5 and 3
C.
2 and 4
D.
4 and 2

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board