By by Allen B. Downey
This edition of the eBook "Java Course" is based on the well-known book by Allen B. Downey, "How to Think Like a Computer Scientist". The main reason for rearranging the original material was to provide the book not only as a printable copy (i.e. as a PDF file) but also as an indexed and easy-to-navigate electronic book which is available both online and offline. In addition, we focused on enhancing the accessibility of the texts by improving the index, by splitting the chapters into managable (and readable) parts, and by adding lots of "see also" hints and cross links.
Finally, we decided to publish this eBook as an MS Windows HTML Help file offering the same navigation structure as the Web-based version. We hope that this service makes it easier for many beginners to learn how to program under Java.
Contents
- The way of the program
- What is a programming language?
- What is a program?
- What is debugging?
- Formal and natural languages
- The first program
- Java Variables and types
- More printingVariables
- Assignment
- Printing variables
- Keywords
- Operators
- Order of operations
- Operators for Strings
- Composition
- Java Methods
- Floating-point
- Converting from double to int
- Math methods
- Composition
- Adding new methods
- Classes and methods
- Programs with multiple methods
- Methods with results
- Java Conditionals, graphics and recursion
- The modulus operator
- Conditional execution
- Alternative execution
- Chained conditionals
- Nested conditionals
- The return statement
- Type conversion
- Slates and Graphics objects
- Invoking methods on a Graphics object
- Coordinates
- A lame Mickey Mouse
- Other drawing commands
- Recursion
- fractal Mickey Mouse
- Stack diagrams for recursive methods
- Convention and divine law
- Fruitful Java methods
- Return values
- Program development
- Composition
- Overloading
- Boolean expressions
- Logical operators
- Boolean methods
- More recursion
- Leap of faith
- One more example
- Java Iteration
- Multiple assignment
- Iteration
- The while statement
- Tables
- Two-dimensional tables
- Encapsulation and generalization
- Methods
- More encapsulation
- Local variables
- More generalization
- Java Strings and things
- Invoking methods on objects
- LengthTraversal
- Run-time errors
- Reading documentation
- The indexOf method
- Looping and counting
- Increment and decrement operators
- Character arithmetic
- Strings are immutable
- Strings are incomparable
- Java Interesting objects
- What's interesting?
- Packages
- Point objects
- Instance variables
- Objects as parameters
- Rectangles
- Objects as return types
- Objects are mutableAliasingnull
- Garbage collection
- Objects and primitives
- Create your own Java objects
- Class definitions and object types
- Time
- Constructors
- More constructors
- Creating a new object
- Printing an object
- Operations on objects
- Pure functions
- Modifiers
- Fill-in methods
- Which is best?
- Incremental development vs. planning
- Generalization
- Algorithms
- Arrays
- Arrays of Objects
- Objects of Arrays
- Object-oriented programming
- Linked lists
- Stacks
- Queues and Priority Queues
- Trees
- HeapTable
- Appendix
- Index