Multiple choice technology programming languages

interface I { //1 public class Inner { ///2 Inner ( ) { System .out . println ( "Inner Created" ) ; } }; }; What is the result of attempting to compile and run the program?

  1. compile time error at line 1

  2. compile time error at line 2

  3. the code compiles fine

  4. none of the above

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

An interface in Java can contain inner classes, which are implicitly public and static. The syntax in the snippet is fully valid, so the code compiles successfully.