Multiple choice technology programming languages

What gets printed when the following program is compiled and run. protected class example {public static void main(String args[]) {String test = "abc";test = test + test;System.out.println(test);}}

  1. The program does not compile because statement "test = test + test" is illegal.

  2. The program prints "abc"

  3. The program prints "abcabc"

  4. The class does not compile because the top level class cannot be protected.

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

Java outer classes cannot be declared with the protected access modifier; they can only be public or package-private. This access modifier violation prevents compilation, making details like string concatenation irrelevant.