Think Java: How to Think Like a Computer Scientist
Free

Think Java: How to Think Like a Computer Scientist

By Allen B. Downey and Chris Mayfield
Free
Book Description
Table of Contents
  • Preface
  • 1. The way of the program
    • 1.1. What is programming?
    • 1.2. What is computer science?
    • 1.3. Programming languages
    • 1.4. The hello world program
    • 1.5. Displaying strings
    • 1.6. Escape sequences
    • 1.7. Formatting code
    • 1.8. Debugging code
    • 1.9. Vocabulary
    • 1.10. Exercises
  • 2. Variables and operators
    • 2.1. Declaring variables
    • 2.2. Assignment
    • 2.3. State diagrams
    • 2.4. Printing variables
    • 2.5. Arithmetic operators
    • 2.6. Floating-point numbers
    • 2.7. Rounding errors
    • 2.8. Operators for strings
    • 2.9. Composition
    • 2.10. Types of errors
    • 2.11. Vocabulary
    • 2.12. Exercises
  • 3. Input and output
    • 3.1. The System class
    • 3.2. The Scanner class
    • 3.3. Program structure
    • 3.4. Inches to centimeters
    • 3.5. Literals and constants
    • 3.6. Formatting output
    • 3.7. Centimeters to inches
    • 3.8. Modulus operator
    • 3.9. Putting it all together
    • 3.10. The Scanner bug
    • 3.11. Vocabulary
    • 3.12. Exercises
  • 4. Void methods
    • 4.1. Math methods
    • 4.2. Composition revisited
    • 4.3. Adding new methods
    • 4.4. Flow of execution
    • 4.5. Parameters and arguments
    • 4.6. Multiple parameters
    • 4.7. Stack diagrams
    • 4.8. Reading documentation
    • 4.9. Writing documentation
    • 4.10. Vocabulary
    • 4.11. Exercises
  • 5. Conditionals and logic
    • 5.1. Relational operators
    • 5.2. Logical operators
    • 5.3. Conditional statements
    • 5.4. Chaining and nesting
    • 5.5. Flag variables
    • 5.6. The return statement
    • 5.7. Validating input
    • 5.8. Recursive methods
    • 5.9. Recursive stack diagrams
    • 5.10. Binary numbers
    • 5.11. Vocabulary
    • 5.12. Exercises
  • 6. Value methods
    • 6.1. Return values
    • 6.2. Writing methods
    • 6.3. Method composition
    • 6.4. Overloading
    • 6.5. Boolean methods
    • 6.6. Javadoc tags
    • 6.7. More recursion
    • 6.8. Leap of faith
    • 6.9. One more example
    • 6.10. Vocabulary
    • 6.11. Exercises
  • 7. Loops
    • 7.1. The while statement
    • 7.2. Generating tables
    • 7.3. Encapsulation and generalization
    • 7.4. More generalization
    • 7.5. The for statement
    • 7.6. The do-while loop
    • 7.7. Break and continue
    • 7.8. Vocabulary
    • 7.9. Exercises
  • 8. Arrays
    • 8.1. Creating arrays
    • 8.2. Accessing elements
    • 8.3. Displaying arrays
    • 8.4. Copying arrays
    • 8.5. Array length
    • 8.6. Array traversal
    • 8.7. Random numbers
    • 8.8. Traverse and count
    • 8.9. Building a histogram
    • 8.10. The enhanced for loop
    • 8.11. Vocabulary
    • 8.12. Exercises
  • 9. Strings and things
    • 9.1. Characters
    • 9.2. Strings are immutable
    • 9.3. String traversal
    • 9.4. Substrings
    • 9.5. The indexOf method
    • 9.6. String comparison
    • 9.7. String formatting
    • 9.8. Wrapper classes
    • 9.9. Command-line arguments
    • 9.10. Vocabulary
    • 9.11. Exercises
  • 10. Objects
    • 10.1. Point objects
    • 10.2. Attributes
    • 10.3. Objects as parameters
    • 10.4. Objects as return types
    • 10.5. Mutable objects
    • 10.6. Aliasing
    • 10.7. The null keyword
    • 10.8. Garbage collection
    • 10.9. Class diagrams
    • 10.10. Java library source
    • 10.11. Vocabulary
    • 10.12. Exercises
  • 11. Classes
    • 11.1. The Time class
    • 11.2. Constructors
    • 11.3. More constructors
    • 11.4. Getters and setters
    • 11.5. Displaying objects
    • 11.6. The toString method
    • 11.7. The equals method
    • 11.8. Adding times
    • 11.9. Pure methods and modifiers
    • 11.10. Vocabulary
    • 11.11. Exercises
  • 12. Arrays of objects
    • 12.1. Card objects
    • 12.2. Card toString
    • 12.3. Class variables
    • 12.4. The compareTo method
    • 12.5. Cards are immutable
    • 12.6. Arrays of cards
    • 12.7. Sequential search
    • 12.8. Binary search
    • 12.9. Tracing the code
    • 12.10. Recursive version
    • 12.11. Vocabulary
    • 12.12. Exercises
  • 13. Objects of arrays
    • 13.1. The Deck class
    • 13.2. Shuffling decks
    • 13.3. Selection sort
    • 13.4. Merge sort
    • 13.5. Subdecks
    • 13.6. Merging decks
    • 13.7. Adding recursion
    • 13.8. Vocabulary
    • 13.9. Exercises
  • 14. Objects of objects
    • 14.1. Decks and hands
    • 14.2. CardCollection
    • 14.3. Inheritance
    • 14.4. Dealing cards
    • 14.5. The Player class
    • 14.6. The Eights class
    • 14.7. Class relationships
    • 14.8. Vocabulary
    • 14.9. Exercises
  • A. Development tools
    • A.1. Installing DrJava
    • A.2. DrJava interactions
    • A.3. Command-line interface
    • A.4. Command-line testing
    • A.5. Running Checkstyle
    • A.6. Tracing with a debugger
    • A.7. Testing with JUnit
    • A.8. Vocabulary
  • B. Java 2D graphics
    • B.1. Creating graphics
    • B.2. Graphics methods
    • B.3. Example drawing
    • B.4. Vocabulary
    • B.5. Exercises
  • C. Debugging
    • C.1. Compile-time errors
    • C.2. Run-time errors
    • C.3. Logic errors
  • Index
    No review for this book yet, be the first to review.
      No comment for this book yet, be the first to comment
      You May Also Like