Break with goto - Java Quiz Question


What will be the output of the following program?

class ContinueExample
{
    public static void main(String s[])
    {
        int sum = 0;
        out : for (int i = 2; i <= 10; i++)
        {
            if (i % 3 == 0)
                break out;
            if (i == 8)
                break;
            sum += i;
        }
        System.out.println("sum = " + sum);
    }
}


A
sum = 18
B
sum = 36
C
sum = 2
D
Compilation Error
E
Runtime Error