README — Java Syntax


What these pages are

These pages are intended as a quick guide to Java syntax, for use by people learning the language. They are richly interlinked, so that it is possible to hop quickly from one topic to another. Each page is flagged with one or more of the following:


These are topics which you need to know about in order to write any reasonable programs. All these topics should be learned in your first few weeks of programming.


These are topics which every Java programmer must learn. You should know all of this material very well by the end of your first course in Java. You don't need it right at the beginning, but it doesn't hurt to look at it.


These are topics which you should learn eventually. Most of them are either (1) important only for certain kinds of programs, or (2) useful but not ever really necessary. If you are first learning Java, you probably should avoid these sections.

Since style is extremely important in programming, numerous style notes have been included.

Style rules are not required by Java compilers, but are widely accepted. If you do not follow these rules, your programs will run, but they will look amateurish and illiterate to experienced Java programmers.

There is a lot of Java syntax, and these pages do not cover it all, even in the "advanced" sections. Similarly, the style rules given in these pages are only the most basic syntax-related style rules.

What these pages are not

These pages are not a complete guide to Java syntax. That would be nice, but I have neither the time nor the energy to do that much work.

These pages describe Java syntax only; they do not cover the Java API.

In many other languages, when you have mastered the syntax and a few library calls, you are done learning the language. In Java, that's akin to mastering the grammar of a foreign language, but not the vocabulary. Beginning Java programmers must learn some of the hundreds of Sun-provided packages, and must learn their way around the Java API (as of June 2005, the current version is at Experienced Java programmers become very familiar with finding what they need in the Java API.

Here are the most important Java API packages for beginners:

java.lang This package contains the most fundamental classes. It is unusual in that the things in this package are automatically available to every Java program--you don't have to explicitly import it.
java.util This package contains many useful utility classes, including most of the Sun-provided data structures.
java.awt These are the most important packages needed to create GUIs (Graphical User Interfaces). All but the most basic GUIs will require some additional packages.

Copyright and copyright restrictions

Copyright © 2005 by David Matuszek
All rights reserved, except as granted below

These pages are freely available for individual use.

If you are an educator, you may:

This copyright notice may not be removed or altered. You may make other changes, corrections, and additions, provided that they are indicated as such. (Minor typographical corrections need not be so indicated.)

If you make significant changes, corrections, or additions, please inform the author, so that they may be included in future versions of these pages.