Appendix B. Exercise Answers

This appendix contains answers (and usually a bit of context) for the review questions at the end of each chapter. The code exercise answers are included with the source download for the example programs, in the exercises folder. Appendix A has details on obtaining the source and setting it up inside IntelliJ IDEA.

Chapter 1: A Modern Language

  1. Which company currently maintains Java?

    While Java was developed in the 1990s at Sun Microsystems, Oracle purchased Sun (and thus Java) in 2009. Oracle maintains ownership and is an active partner in the development and distribution of its own commercial JDK and the open source OpenJDK.

  2. What is the name of the open source development kit for Java?

    The open source version of the JDK is known as the OpenJDK.

  3. Name the two main components that play a role in Java’s approach to securely running bytecode.

    Java has many features that relate to security, but the main components at play in every Java application are the class loader and the bytecode verifier.

Chapter 2: A First Application

  1. What command should you use to compile a Java source file?

    If you are working in a terminal, the javac command compiles Java source files. While the details are often hidden when using an IDE like IntelliJ IDEA, the IDE is also using javac behind the scenes.

  2. How does the JVM know where to start when you run a Java application?

    Any executable Java class must have a main() method defined. The JVM uses this method as the ...

Get Learning Java, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.