Game Development Reference
In-Depth Information
programming constructs, and how to
comment
your code. Examining this first will
give you a head start at being able to read Java code, as it is important to be able to dis-
cern the Java code from the commentary regarding that code (which is usually written
by the author of the Java code using comments).
Then, you will consider the top-level concept of
APIs
, as well as what a
package
is, and how you can
import
and use the preexisting code that is provided by Java pack-
ages. These Java packages are a part of the Java 8 API, and it is important to note that
you can create custom Java packages of your own, containing your games or applica-
tions.
After that, you will consider the constructs that are held inside of these Java pack-
ages, which are called Java
classes
. Java classes are the foundation of Java program-
ming, and can be used to build your applications (in this case, your Java 8 games). You
will learn about the
methods
,
variables
, and
constants
that these classes contain, as
well as what superclasses and subclasses are, and what nested classes and inner classes
are, and how to utilize them.
Finally, you will discover what Java
objects
are, and learn how they form the
foundation of
Object Oriented Programming
(
OOP
). You will also come to know
what a
constructor
method is, and how it creates the Java object, by using a special
kind of method called a
constructor method
that has the same name as the class that it
is contained in. Let's get started—we have a lot of ground to cover!
TheSyntaxofJava:CommentsandCode
Delimiters
There are a couple of things regarding
syntax
, meaning how Java writes things in its
programming language, that you need to consider right off of the bat. These primary
syntax
rules
are there to allow the Java
compiler
to understand how you are structur-
ing your Java code. Java
compilation
is the part of the Java programming process, in
which the JDK compiler (program) turns your Java code into
bytecode
that is executed
or run by a Java
Runtime
Engine (JRE). This JRE, in this case it is JRE 8, is installed
on your end user's computer system. The Java compiler needs to know where your
Java code blocks begin and end, where your individual Java programming statements
or instructions begin and end within those Java code blocks, and which parts of your
code are Java programming logic, and which parts are comments to yourself, or com-
ments (notes) to other members of your game project programming team.