Menu
Question Index
...

What will be the output of the following program?

public class ArrayAccesing {
    public static void main(String[] args) {
        int[] input = new int[3];
        for (int j = 0; j <= input.length; j++) {
            System.out.println(input[j] + " " + j);
        }
    }
}


0 0
0 1
0 2
0 0
0 1
0 2
0 3
Compilation Error
Runtime Error

Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App