FREE Java Lessons

 

Introduction:

This free, copyrighted material may be used in accordance with certain rights and restrictions.

Lessons are concise and cover many elements needed to become a Sun Certified Java Programmer. Each concludes with a number of certification-style questions. Non-commercial users may request a free copy of the answer key by sending an e-mail to .

In addition to the sample programs listed below, small embedded programs are contained within each lesson. All can be run using free Java development software. For more information, see the documentation on running Java programs.

Although a book is not essential to master lesson material, an accompanying reference can be helpful. Of all the Java books on the market, the following are best-suited to accompany these lessons:

 

Java lessons:

Lesson 01 - What is Java?

Lesson 02 - Anatomy of a simple Java program

Lesson 03 - Identifiers and primitive data types

Lesson 04 - Variables, constants, and literals

Lesson 05 - Arithmetic operations, conversions, and casts

Lesson 06 - Boolean expressions and operations

Lesson 07 - Bitwise operations

Lesson 08 - Flow control with if and else

Lesson 09 - switch statements

Lesson 10 - for, while, and do-while statements

Lesson 11 - Using break and continue

Sample 01 - A menu-driven program that performs some common financial calculations

Lesson 12 - Class methods and how they are called

Lesson 13 - Using the Math class

Lesson 14 - Creating and calling custom class methods

Lesson 15 - Overloading class methods

Lesson 16 - An introduction to objects and object references

Lesson 17 - The String class

Lesson 18 - The StringBuffer class

Lesson 19 - Initializing and processing arrays of primitives

Lesson 20 - Initializing and processing arrays of objects

Lesson 21 - Passing an object or an array to a method

Sample 02 - A menu-driven program that uses coordinated arrays to record sales data

Lesson 22 - Defining an instantiable class

Lesson 23 - static and instance features of a class

Lesson 24 - The wrapper classes

Sample 03 - A menu-driven program that uses an array of sales representative objects

Lesson 25 - Inheritance and overriding inherited methods

Lesson 26 - abstract classes and polymorphism

Lesson 27 - Interfaces, instanceof, and object conversion and casting

Lesson 28 - Inner classes

Sample 04 - A menu-driven program that uses polymorphism to maintain fast food orders

Lesson 29 - Introduction to graphical programming and the java.awt package

Lesson 30 - The Component class

Lesson 31 - Containers and simple layout managers

Lesson 32 - The Color and Font classes

Lesson 33 - Drawing geometric shapes

Lesson 34 - Button, Label, TextField, and TextArea controls

Lesson 35 - Choice, List, and Checkbox controls

Lesson 36 - Using the Scrollbar graphical control

Lesson 37 - Menus and submenus

Lesson 38 - The WindowListener interface and the WindowAdapter class

Sample 05 - A graphical, event-driven, windows program to calculate the amount due for an order

Lesson 39 - An introduction to applets and the Applet class

Lesson 40 - Essential HTML to launch an applet and pass it parameters

Lesson 41 - Mouse event processing

Lesson 42 - Keyboard event processing

Lesson 43 - Using CardLayout

Lesson 44 - An introduction to GridBagLayout

Lesson 45 - An introduction to the Java Collections API (List, Set, and SortedSet)

Lesson 46 - Using Map and SortedMap collections

Sample 06 - An applet to record price changes for a collection of item objects

Lesson 47 - Exception handling with try, catch, and finally blocks

Lesson 48 - Claiming and throwing exceptions

Lesson 49 - Multithreading, the Thread class, and the Runnable interface

Lesson 50 - Synchronization and locking

Sample 07 - An applet that runs a multi-threaded shipping and receiving simulation

Lesson 51 - An introduction to I/O and the File and FileDialog classes

Lesson 52 - Low-level and high-level stream classes

Lesson 53 - Using the RandomAccessFile class

Lesson 54 - An introduction to client / server programming

Sample 08 - A client/server shipping application with disk I/O on the server side