28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3<br />

A <strong>Java</strong> 8 Primer: An Introduction<br />

to <strong>Java</strong> 8 Concepts and Principles<br />

Let’s build on the knowledge you gained about NetBeans IDE 8.0 in the previous chapter by exploring the basic<br />

concepts and principles behind the <strong>Java</strong> 8 programming language. <strong>Java</strong> JDK 8 will be the foundation for your <strong>Java</strong><br />

8 games, as well as for your NetBeans IDE 8.0, so it is important that you take the time to study this chapter, a <strong>Java</strong> 8<br />

“primer” that gives you an overview of this internationally popular computer (and device) programming language.<br />

You will of course learn about more advanced concepts, such as Lambda Expressions, and about other <strong>Java</strong> 8<br />

components, such as the recent <strong>Java</strong>FX multimedia engine, as you progress through the book, so be aware that this<br />

chapter will cover the most foundational <strong>Java</strong> programming language concepts, techniques, and principles, spanning<br />

the three major versions of <strong>Java</strong> SE currently in widespread use today, on computers, iTVs, and handheld devices.<br />

These versions of <strong>Java</strong>, used by billions of users, include <strong>Java</strong> 6, which is used in the 32-bit Android 4.x OS and<br />

applications; <strong>Java</strong> 7, which is used in the 64-bit Android 5.x OS and applications; and <strong>Java</strong> 8, which is used across<br />

many popular OSs, such as Microsoft Windows, Apple OS X, Oracle Solaris, and a plethora of popular Linux “distros,”<br />

or distributions (custom Linux OS versions, such as SUSE, Ubuntu, Mint, Mandrake, Fedora, and Debian).<br />

You will start with the easiest concepts, the highest level of <strong>Java</strong>, and progress to the more difficult ones, the<br />

guts of the <strong>Java</strong> programming constructs. You will begin, with a study of <strong>Java</strong> syntax, or lingo, including what <strong>Java</strong><br />

keywords are, how <strong>Java</strong> delimits its programming constructs, and how to comment your code. Examining this first<br />

will give you a head start at being able to read <strong>Java</strong> code, as it is important to be able to discern the <strong>Java</strong> code from the<br />

commentary regarding that code (which is usually written by the author of the <strong>Java</strong> code using comments).<br />

Then, you will consider the top-level concept of APIs, as well as what a package is, and how you can import and<br />

use the preexisting code that is provided by <strong>Java</strong> packages. These <strong>Java</strong> packages are a part of the <strong>Java</strong> 8 API, and it is<br />

important to note that you can create custom <strong>Java</strong> packages of your own, containing your games or applications.<br />

After that, you will consider the constructs that are held inside of these <strong>Java</strong> packages, which are called <strong>Java</strong><br />

classes. <strong>Java</strong> classes are the foundation of <strong>Java</strong> programming, and can be used to build your applications (in this case,<br />

your <strong>Java</strong> 8 games). You will learn about the methods, variables, and constants that these classes contain, as well as<br />

what superclasses and subclasses are, and what nested classes and inner classes are, and how to utilize them.<br />

Finally, you will discover what <strong>Java</strong> objects are, and learn how they form the foundation of Object Oriented<br />

Programming (OOP). You will also come to know what a constructor method is, and how it creates the <strong>Java</strong><br />

object, by using a special kind of method called a constructor method that has the same name as the class that it is<br />

contained in. Let’s get started—we have a lot of ground to cover!<br />

The Syntax of <strong>Java</strong>: Comments and Code Delimiters<br />

There are a couple of things regarding syntax, meaning how <strong>Java</strong> writes things in its programming language, that you<br />

need to consider right off of the bat. These primary syntax rules are there to allow the <strong>Java</strong> compiler to understand<br />

how you are structuring your <strong>Java</strong> code. <strong>Java</strong> compilation is the part of the <strong>Java</strong> programming process, in which the<br />

www.it-ebooks.info<br />

43

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!