Java Au Naturel

A computer science textbook by Dr. William C. Jones, Jr.
Fourth Edition   copyright May 26, 2004    www.javabook.org

Over 100 high school and college instructors across the U.S.A. and around the world are teaching from this textbook.

The first link in the following is the pdf file for the text material. The second link ("listings") is the source code for the program listings, in a form from which you can copy-and-paste (but not into a Word document, since it loses indents and line breaks; Notepad is okay, though).

DOWNLOADING: When viewing a file with a browser, you can click File/SaveAs... except that some browsers disable this for PDF files. Alternative: Put your mouse cursor on a link below (such as the one that says "Chapter 1") and right-click the mouse. This should give you a menu that allows you to choose "SaveLinkAs..." (in Netscape) or "SaveTargetAs..." (in IE). Click that option, then choose the folder on your hard drive where you want to save the PDF or HTM file. Frequent users should download the book in zipped form and unzip it to their own hard drive or a writable CD (roughly 4 MEGS, including these web pages).

Table of Contents and Preface to Student     10 pages
         Running programs in Chapter One requires  Turtle.java and its superclass  Turtlet.java
         Sample program for Chapter One:   ProgramOne.java
         Running the programs in Chapters Two and Three requires this file:    Vic.java
         If using BlueJ with these graphics classes, you will need to move their graphics window
         in front of the BlueJ window. With Turtles, it helps to make the first Turtle command
         a 5-second sleep command to give you time for this.

Chapter 1 Objects     34 pages     listings
         overview. subclasses. defining and using void instance methods for objects that draw pictures.
Chapter 2 Conditionals and Boolean Methods    36 pages     listings
         defining and using boolean instance methods. if-else statements. boolean operators. UML.
Chapter 3 Loops and Parameters    32 pages     listings
         while statements. parameters. more on analysis and design. more UML.

Interlude: Integers and For-loops      6 pages included with Chapter Four
Chapter 4 Instance Variables    42 pages     listings
         JOptionPane for I/O. defining instance variables and constructors. polymorphism. BlueJ.
    New: Simplified event-handling.
Chapter 5 Class Methods and Class Variables     34 pages     listings
         defining and using class members. final variables. scope. networks and recursion (optional).
Review: Overall Java Language So Far    6 pages included at the end of Chapter Five

Chapter 6 Basic Data Types and Expressions    43 pages     listings
         doubles, Strings, chars, longs. Math. MVC pattern.
Chapter 7 Arrays     41 pages     listings
         array algorithms. sequential search. insertion sort. basic 2-dimensional arrays.

Chapter 8 Elementary Graphics     40 pages     listings
         applets. Graphics2D and the Shape classes. extended analysis and design.
    New: Turtle is a subclass of Turtlet, which can be used for applets.
Chapter 9 Exception-Handling    38 pages     listings
         runtime exceptions. try/catch. checked exceptions. additional Java statements.

Chapter 10 Event-Driven Programming     44 pages     listings
         frames and components. textfields and buttons. more MVC. sliders, timers, menus, mice.
Chapter 11 Abstract Classes and Interfaces    40 pages     listings
         interfaces. instanceof. polymorphism. Double, Integer, and other wrappers.
Chapter 12 Files and Multidimensional Arrays    36 pages     listings
         FileReader and FileWriter. StringTokenizer. RandomAccessFile. bytecode.
Chapter 13 Sorting and Searching    32 pages     listings
         selection sort, insertion sort, big-oh, binary search, quicksort, mergesort, shellsort.

Chapter 14 Stacks and Queues     42 pages     listings
         implementing stacks and queues with arrays and linked lists (header and trailer nodes).
Chapter 15 Collections and Linked Lists     40 pages     listings
         implementing Collection, Iterator, and ListIterator with arrays and linked lists. doubly-linked lists.
Chapter 16 Maps and Linked Lists     42 pages     listings
         implementing Map and Iterator with arrays and linked lists. Scheme interpreter. hash tables.
Chapter 17 Binary Trees     42 pages     listings
         implementing Map and Iterator with binary trees. red-black and AVL trees. data flow diagrams.
Chapter 18 Priority Queues, Heaps, and More Sorting     38 pages     listings
          implementing priority queues with arrays and linked lists. treesort, heapsort, external sorting.
Chapter 19 Graphs     38 pages     listings
          list and matrix implementations. Prim's, Kruskal's, Dijkstra's algorithms. dynamic programming.
Chapter 20 Models of Computation     36 pages     listings
          finite automata, pushdown automata, Turing Machines, and solvability. context-free LL(1).

Appendices     54 pages     listings
Appendix A Guidelines for Program Style                APP-1
Appendix B Glossary of Terms                                  APP-5
Appendix C Common Compile-Time Errors            APP-17
Appendix D Java Reserved Words                            APP-22
Appendix E Sun Library Classes                               APP-23
Appendix F Major Programming Projects               APP-29

Dr. Bradley Kjell has very helpful webpages providing additional practice with Java, although they are not coordinated with this book. The object-oriented webpages can be covered much earlier than his numbering indicates.

Easy Buttons and Textfields and associated files
Learn to write applications using buttons and textfields during the early part of the course. This is quite accessible with Chapter Four, but independent of my textbook.

My course syllabi using this book can be linked to from this main page.

Site Meter