Pro Java 9 Games Development Leveraging the JavaFX APIs

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

are 1,000 pages or more, so if you want to get really deep into pure Java, I suggest the Pro Java Programming
book from Apress. Of course, we’ll be learning more about Java as we progress through this book, as well as
learning about the JavaFX 9.0 engine’s classes.
We started by taking a high-level view of Java by looking at the syntax of Java, including Java comments
and delimiters, and then we took a look at what Application Programming Interfaces (APIs) are. We also
learned about the Java packages that a Java API contains.
Next, we covered Java classes, including nested classes and inner classes, since these Java packages
contain Java classes. We learned that a Java class has a constructor method that can be used to instance
objects from a class.
The next level down in Java is the method, which is like the functions you are familiar with in many of
your other programming languages, and we looked at a required type of Java method called the constructor
method.
Next we took a look at how Java represents data using fields, or data fields, and we looked at the different
types of data fields such as constants (fixed data fields) and variables (or data fields that can change their
values).
After that, we took a closer look at Java access control modifier keywords, including public, private,
and protected access control keywords, and then we looked at the nonaccess modifier keywords, including
the final, static, abstract, volatile, and synchronized nonaccess control modifier keywords.
After we finished covering the basic code structures and how to modify them to do what we wanted
them to do, we looked at the primary Java data types, such as boolean, char, byte, int, float, short, long, and
double, and then we looked at the Java operators that are used to process or “bridge” these data types over
to our programming logic. We looked at arithmetic operators for use with numeric values, logical operators
for use with boolean values, relational operators to look at relationships between data values, conditional
operators to allow us to establish any conditional variable assignments, and assignment operators that
allow us to assign values to (or between) variables.
Next, we looked at Java logic control structures, including decision-making (I like to call them decision
trees) control structures and looping, or iterative logic control structures. We learned about the Java switch-
case structure, the if-else structure, the for loop structure, and the do-while loop structure.
Next, we looked at Java objects and learned how to define object attributes, states, and behaviors
using a Java class, methods, and constructor methods, and we looked at the Java OOP language concepts of
inheritance and the public Java interface and learned how to implement these using Java code.
Finally, we looked at Java modules, added in Java 9, and learned how to define module hierarchies
and module types using an example of how this was done for the JavaFX API, the first major Java API to
be modularized. We learned about the advantages of Java 9 modules and how this was a major step in
reworking the Java language to obtain the security level that the public has come to expect from the language
and that we’ve all been waiting for.
In the next chapter, we’re going to look at the NetBeans 9 integrated development environment (IDE)
and how to create the foundation (project and core APIs) for your game development during the rest of
this book.

Free download pdf