Sams Teach Yourself Java™ in 24 Hours (Covering Java 7 and Android)

(singke) #1
ptg

8 HOUR 1:Becoming a Programmer


programs run more quickly than interpreted programs but take more time
to test. You have to write your program and compile it before trying it out.
If you find an error and fix it, you must compile the program again.
Java is unusual because it requires both a compiler and an interpreter. You
learn more about this later as you write Java programs.

When Programs Don’t Work
Many new programmersbecome discouraged when they start to test their
programs. Errors appear everywhere. Some of these are syntax errors,
which are identified by the computer as it looks at the program and
becomes confused by what you wrote. Other errors are logic errors, which
are noticed only by the programmer as the program is being tested (and
might be overlooked entirely). Logic errors sneak by the computer unno-
ticed, but they often cause it to do something unintended.
As you begin writing your own programs, you become well acquainted
with errors. They’re a natural part of the process. Programming errors are
called bugs, a term that dates back a century or more to describe errors in
technical devices. The process of fixing errors has its own term also: debug-
ging. It’s no coincidence that so many ways exist to describe programming
errors. You get a lot of debugging experience as you learn programming—
whether you want it or not.

Choosing a Java Programming Tool
Before you can start writing Java programs, you need Java programming
software. Several programs are available for Java, including the Java
Development Kit, Eclipse, IntelliJ IDEA, and NetBeans. Whenever Oracle
releases a new version of Java, the first tool that supports it is the Java
Development Kit (JDK).
To create the programs in this book, you must use version 7 of the JDK or
another programming tool that can work in conjunction with it. The JDK is
a set of free command-line tools for creating Java software. The JDK lacks a
graphical user interface, so if you have never worked in a nongraphical
environment such as DOS or Linux, you’re going to be shocked—and not
in a good way—when you start using the JDK.
Oracle offers another free tool, the NetBeans integrated development envi-
ronment, that’s a much better way to write Java code. NetBeans offers a
Free download pdf