Multiple choice general knowledge

What is the result of compiling this source file? public class Book { private int pageNumber; private class BookReader { public int getPage() { return pageNumber; } } }

  1. The code compiles successfully and one bytecode file is generated: Book.class.

  2. The code compiles successfully and two bytecode files are generated: Book.class and BookReader.class.

  3. The code compiles successfully and two bytecode files are generated: Book.class and Book$BookReader.class.
  4. A compiler error occurs on line 4.

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

In Java, inner class bytecode files use the $ notation. A top-level class Book generates Book.class, while its inner class BookReader generates Book$BookReader.class. The file BookReader.class is never created for inner classes.