Menu
Question Index
...

At what line does the program fail to compile?

public class IntegerAddition {

    static int total = 0;

    public static void main(String[] args) {
        int a[] = { 2, 3, 4}; /* LINE A */
        int[] b = new int[4];
        int c[] = new int[] { 5, 6, 7}; /* LINE B */
        int total[][] = { a, b, c}; /* LINE C */

        for (int[] array1d : total) {
            for (int element : array1d) {
                IntegerAddition.total += element; /* LINE D */
            }
        }
        System.out.println("Total = " + IntegerAddition.total);
    }
}


LINE A
LINE B
LINE C
LINE D
No Compilation Errors

Doubts

Problems

Topic: Unknown

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App