Java Reference
In-Depth Information
Chapter 1
Java Basics
After a very short history of Java, we will jump right into Java programming. We will create and use a bare bones
program to demonstrate the Java basics and the capabilities of Rational Application Developer.
After finishing this chapter, you should understand:
Basic Java keywords and syntax
Classes, methods, and variables
Constructors and comments
Perspectives and views
Using WebSphere, you will be able to:
Create projects, packages, and classes
Use and customize perspectives and views
Write a basic Java application
Run a Java application
The Java Language
Java shares many of the same characteristics as spoken and written languages such as English, Spanish, and so
on. For instance, both Java and spoken languages consist of a unique set of words. In Java, these words are called
keywords . Java also uses symbols (; , {}, (), etc.), just as written languages use punctuation marks. All of the symbols
and keywords that comprise the Java language are referred to as tokens . (Another definition of a token is the smallest
unit of the Java language.) We mention this right at the beginning of the text because error messages often cite an
“incorrect token” or “token expected” as problems—not that we are expecting you to make any errors!
Programming languages also have rules of grammar that must be followed. These grammar rules are called
the programming language's syntax . Just as a written language's grammar dictates how to combine words and
punctuation into sentences and paragraphs, the Java syntax dictates how tokens are combined to create Java
statements, methods, and classes.
Who makes the rules? Oracle. Sun Microsystems (acquired by Oracle in 2009) originally developed Java in the
early 1990s and modeled it after the very popular C++ programming language. Java shares many of the same syntax
rules and keywords as C++ but the major difference with Java is its network orientation. The Java language was
designed so that graphical, two-way interactions between computing devices can be easily created.
In the early 1990s, the Internet was primarily text-based. Sun, working with Netscape, enabled the Netscape
browser to download Java applets from another computer (called a server). The applet ran on the user's PC
(known as the client), and the applet results were displayed in the browser window.
 
Search WWH ::




Custom Search