One fast way to learn or review Java is through the superb tutorials provided by Sun. They mostly pick one topic or one closely related set of topics. They have code that you can copy into your favorite editor or IDE (why not Eclipse?), run, and experiment with.
As noted, a fine set of examples is to be found at:
http://www.idevelopment.info/data/Programming/java/PROGRAMMING_Java_Programming.shtml
Collections, I/O, JDBC, serialization, JavaDoc, reflection, regular expressions,
and much, much more. Complete programs, with copious explanations.
There are many, many other tutorials to be found by Googling for a topic and adding the word tutorial. Some will be listed after the Sun tutorials.
This trail covers the fundamentals of programming in the Java programming language.
Object-Oriented Programming Concepts teaches you the core concepts behind object-oriented programming: objects, messages, classes, and inheritance. This lesson ends by showing you how these concepts translate into code. Feel free to skip this lesson if you are already familiar with object-oriented programming.
Language Basics describes the traditional features of the language, including variables, data types, operators, and control flow.
Object Basics and Simple Data Objects shows you the general principles for creating and using objects of any type. Then, this lesson describes how to use arrays, strings, and number objects, which are commonly used object types. Finally, this lesson shows you how to format data for output.
Classes and Inheritance describes how to write the classes from which objects are created.
Interfaces and Packages are features of the Java programming language that help you to organize and structure your classes and their relationships to one another.
Common Problems (and Their Solutions) explains the solutions to some problems you might run into while learning the Java language.
The lessons in this trail give a quick introduction to Java programming. They tell you what Java is and provide you with an opportunity to compile and run some simple Java programs. Finally, they give you the background knowledge you need to understand how the programs work.
Having Trouble Getting Started? Try the detailed instructions in Your First Cup of Java: for Microsoft Windows, for UNIX, or for Mac OS.
The Java Phenomenon lesson talks a bit about the Java language and platform. Its aim is to give you an idea of what Java can do for you. It also covers some basic Java concepts that will help you understand the process of writing a Java program. If you can't wait to write your first program, skip ahead to one of the following two lessons.
The most common Java programs are applications and applets. Applications are standalone programs, such as the HotJava browser. Applets are similar to applications, but they don't run standalone. Instead, applets adhere to a set of conventions that lets them run within a Java-compatible browser. If you're using a browser that can view applets, you should see an animation just below this paragraph -- that's an applet embedded in this HTML page.
The placeholder icon above indicates that if you follow the link to the Sun site, you will see an applet of the Java mascot, Duke, waving at you.
Before you go on: If you don't own a Java development environment, you might want to download the Java 2 Platform
. The Java 2 SDK, Standard Edition provides a compiler you can use to compile all kinds of Java programs. It also provides an interpreter you can use to run Java applications. To run Java applets, you can use the Applet Viewer (included in the SDK) or any Java-compatible Web browser, such as the HotJava browser.
![]()
The "Hello World" Application leads you through compiling and running a standalone application-- a Java program that executes independently of a browser. The lesson also introduces some general Java techniques: how to define a class and how to use supporting classes and objects.
The "Hello World" Applet tells you how to compile and run an applet--a Java program to be included in HTML pages and executed in Java-enabled browsers. The lesson also introduces some general Java concepts and techniques: how to create a subclass, what packages are, and how to import classes and packages into a program.
Common Compiler and Interpreter Problems (and Their Solutions) is the place to go if you have trouble compiling or running the programs in this trail.
Also known as The Swing Tutorial
DDM Note: JFC means "Java Foundation Classes." That was planned to be the name; the internal pre-release code name was Swing. The name Swing stuck. Java programmers are said to claim "It's spelled J-F-C, but pronounced "Swing."
Getting
Started with Swing is a quick start lesson. First it gives you a bit of
background about the JFC and Swing. Then it tells you how to compile and run
programs that use Swing components. Next, it shows you how to run programs using
Java Web Start.
Learning Swing by Example explains the concepts you need to use Swing
components in building a user interface. It is built around several
progressively complicated examples, so you'll learn the basics by examining code
samples.
Using
Swing Components tells you how to use each of the Swing components —
buttons, tables, text components, and all the rest.
Using
Other Swing Features tells you how to use actions, borders, icons, and
timers. It also helps you to create multithreaded programs.
Laying
Out Components Within a Container tells you how to choose a layout
manager, how to use each of the layout manager classes the JavaTM
platform provides, how to use absolute positioning instead of a layout manager,
and how to create your own layout manager.
Writing
Event Listeners tells you how to handle events in your programs.
Performing Custom Painting gives you information on painting your own
Swing components. It discusses painting issues specific to Swing components,
provides an overview of painting concepts, and has examples of custom components
that paint themselves.