Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 5 ■ a Java primer: introduCtion to Java ConCepts and prinCiples

Note that the nested Java code, inside each of these red squares, begins with a curly brace and ends with
a curly brace. Now that you are familiar with the various Java code commenting approaches, as well as how
your Java programming statements need to be delimited (both individually and as Java code blocks), you’re
going to take a look at the various Java code structures. You will see how they’re used, what they can do for
your applications and games, and which important Java keywords are utilized in order to implement your
Java programming structures.


Java Packages: Organizing the Java API by Function


At the highest level of a programming platform, such as Google’s 32-bit Android 4 (which uses Java SE 6),
64-bit Android 5 (which uses Java SE 7), or the current Oracle Java SE platform (which was recently released
as Java SE 9), there is a collection of packages that contains classes, interfaces, methods, and constants,
which collectively form the Application Programming Interface (API). This collection of Java code (in
our case, this is currently the Java 9 API) can be used by application (in this case, games) developers to
create professional-level software across many OSs, platforms, and consumer electronics devices such as
computers, laptops, netbooks, tablets, HD and UHD iTV sets, e-book readers, and smartphones.
To install a given version of an API level, you install its Software Development Kit (SDK). The Java
SDK has a special name, the Java Development Kit (JDK). Those of you who are familiar with Android
development (Android is actually Java on top of Linux OS) know there’s a different API level released every
time a few new features have been added. This is because of the fact that hardware devices that run Android
add new hardware features that need to be supported, not because Google feels like releasing a new SDK
every couple months. Android has released over 26 different API levels in just a few years, whereas Java SE
has released only nine in more than a decade. Only four of Java’s API levels (Java 6, 7, 8, and 9) are in active
use currently in billions of consumer electronics devices.
Java 6 is used with Eclipse’s ADT IDE to develop for 32-bit Android (versions 1.5 through 4.4), Java 7
is used with Android Studio to develop for 64-bit Android (versions 5.x, 6, 7.x), Java 8 is used with the IntelliJ
IDE to develop for Android Studio 3.0, and Java 9 is used across the Windows, Macintosh, Linux,


Figure 5-2. Nested Java code blocks for InvinciBagel class, start method, setOnAction method, and the handle
method

Free download pdf