Menu
Question Index
...

What will be the output of the following program?

class forEachloop
{
    public static void main(String args[])
    {
        int[] scores = {215, 234, 218, 189, 221, 290};
        int score = 0;
        for(score : scores)
        {
            System.out.print(scores + "  ");
        }
    }
}


215 234 218 189 221 290
Prints the reference values
Compilation Error
Throws ArrayIndexOutOfBoundsException

Doubts

Problems

Topic: For-each Loop In Core Java Programming

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App