By Carl Burch, a professor for Hendrix College in Conway, Arkansas, USA. To contact the author, send e-mail to cburch at cburch dot c o m. [Other books by Carl Burch]

Table of Contents

1. Programming overview
   1.1. About Java (optional)
   1.2. The programming process
   1.3. Libraries used by this book
   1.4. A simple program
   1.5. Programming style

2. Variables and objects
   2.1. The DrawLine program
   2.2. Variable declaration
   2.3. Variable assignment
   2.4. Instance methods

3. More on objects
   3.1. Reading class documentation
   3.2. Using class documentation
   3.3. Multiple names for the same object

4. Using numbers
   4.1. Numeric types
   4.2. Return values
   4.3. Arithmetic
   4.4. Exceptions

5. Repetition
   5.1. The while loop
   5.2. Conditions
   5.3. Incrementing assignments

6. Graduating to a bigger sandbox
   6.1. A simple program
   6.2. Using shortcuts
   6.3. Animation
   6.4. Compounding shapes

7. Conditional execution
   7.1. The if statement
   7.2. The bouncing ball
   7.3. The else clause
   7.4. Braces
   7.5. Variables and compile errors

8. Strings
   8.1. The String class
   8.2. String input and output
   8.3. String methods
   8.4. Equality testing

9. More on loops
   9.1. The for loop
   9.2. The break statement

10. More on classes
   10.1. Packages
   10.2. Static methods
   10.3. Constants

11. Subclasses
   11.1. Fundamentals of subclasses
   11.2. The Object class
   11.3. Subclasses and variables
   11.4. Example: Psychedelic balls
   11.5. Casting
   11.6. The instanceof operator

12. Defining methods
   12.1. Defining methods
   12.2. Parameters
   12.3. Methods and variables

13. User interaction
   13.1. Accepting mouse events
   13.2. The null reference
   13.3. Instance variables
   13.4. Another example: Pong

14. Defining classes
   14.1. A simple example
   14.2. Instance variables
   14.3. Protection levels
   14.4. Another example: Fractions

15. Making subclasses

16. Abstract classes & interfaces

17. Recursion
   17.1. A first example
   17.2. How recursion works
   17.3. Recursion versus iteration

18. Recursion examples
   18.1. Fibonacci numbers
   18.2. Anagrams
   18.3. Sierpinski Carpet
   18.4. Tree

19. Arrays
   19.1. Basics
   19.2. Computing the mode
   19.3. Arrays of objects

20. Sorting
   20.1. Selection sort
   20.2. Insertion sort
   20.3. Mergesort
   20.4. Comparison

21. Other control constructs

22. File I/O
   22.1. The char type
   22.2. Elementary file manipulation
   22.3. Text file manipulation

23. Beyond the sandbox

24. Swing basics
   24.1. The simplest GUI
   24.2. Inserting components
   24.3. Interfaces
   24.4. Event listeners
   24.5. Composing GUIs

25. More with Swing
   25.1. A customized component
   25.2. Handling mouse interaction