Computer Science, asked by harshkr49921, 17 hours ago

{
public static void main (String[] args)
{
int[] arr = new int[2];
arr[0] = 10;
arr[1] = 20;
for (int i = 0; i <= arr.length; i++)
System.out.println(arr[i]);
}

Answers

Answered by purveshKolhe
5

Answer::

It will print 20 as your output.

Reason ::

==> The value of i has became 1 and as it asks to print the array, the 2nd value will be printed.

Note : - Arrays start at 0.

Hope this helps you.

Similar questions