Multiple choice

Which of the following is the output of the given program?

public static void main(Stirng[] args)
{
int x = 353;
int j = x++;
switch (j)
{
case 317: case 353: case 367: System.out.println(Is a prime number.);
case 353: case 363: System.out.println(Is a palindrome.);
break;
default: System.out.println(Invalid value.);
}
}

  1. It is a prime number.

  2. It is a palindrome.

  3. It is a prime number. It is a palindrome.

  4. Invalid value

  5. Compilation fails

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

This is the correct choice. The program contains a compilation error. The switch contains two duplicate case values (353) which is not allowed in java.