Chapter 0 Inheritance and Polymorphism¶
- 0.1. Inheritance and Polymorphism: Subclasses and Methods
- 0.1.1. The Jeroos of Santong Island
- 0.1.2. Class Hierarchy and Inheritance
- 0.1.3. Syntax Practice 2a: Jeroo Methods
- 0.1.4. Problem Solving and Algorithms
- 0.1.5. Creating and Using Jeroo Methods
- 0.1.6. Syntax Practice 2b: Subclass Constructors
- 0.1.7. Programming Practice 2
- 0.1.8. Check Your Understanding
Chapter 1 Conditional and Repeating Actions¶
- 1.1. Conditional and Repeating Actions
- 1.1.1. Selection
- 1.1.2. Conditions Using Sensor Methods
- 1.1.3. Java’s Syntax for the If-Then-Else Structure
- 1.1.4. Syntax Practice 3a: If-Then-Else
- 1.1.5. Creating Optional Statements With If-then
- 1.1.6. Java’s Syntax for the If-then Structure
- 1.1.7. Syntax Practice 3b: If-Then
- 1.1.8. Java’s Syntax for the Multi-way Selection Structure (a cascaded if)
- 1.1.9. Syntax Practice 3c: Multi-way If
- 1.1.10. Compound Conditions
- 1.1.11. Syntax Practice 3d: Compound Conditions
- 1.1.12. Repeating Actions
- 1.1.13. Generic Repetition Structures
- 1.1.14. Java’s Syntax for the While Loop
- 1.1.15. Syntax Practice 3e: While Loops
- 1.1.16. Programming Practice 3
- 1.1.17. Check Your Understanding
Chapter 2 Software Testing¶
- 2.1. Software Testing
- 2.1.1. What Is Software Testing?
- 2.1.2. Writing Your First Software Test
- 2.1.3. Check Your Understanding: Software Testing Concepts
- 2.1.4. More About Methods
- 2.1.5. Check Your Understanding: Method Signatures
- 2.1.6. Check Your Understanding: Methods with Parameters
- 2.1.7. Good Habits for Conditionals
- 2.1.8. A Different Type of Complex If-Statement
- 2.1.9. Short Circuit Evaluation
- 2.1.10. Check Your Understanding: Logical Equivalence
- 2.1.11. Syntax Practice 4
- 2.1.12. Programming Practice 4
- 2.1.13. Module Review
Chapter 3 Variables, Fields, and Parameters¶
- 3.1. Variables, Fields, and Parameters
- 3.1.1. Variables
- 3.1.2. Check Your Understanding: Variables
- 3.1.3. Fields Versus Local Variables
- 3.1.4. Changing Private Variables: Mutator Methods
- 3.1.5. Check your Understanding: Scope
- 3.1.6. Accessor Methods
- 3.1.7. Check Your Understanding: Fields, Getters and Setters
- 3.1.8. The Return Keyword
- 3.1.9. Check your Understanding: Typed Methods and Return Statements
- 3.1.10. Using Fields in Testing
- 3.1.11. Syntax Practice 5
- 3.1.12. Programming Practice 5
Chapter 4 Pictures and For-each Loops¶
Chapter 5 Aggregation, Strings and More Loops¶
- 5.1. Aggregation, Strings and More Loops
- 5.1.1. Object-Oriented Design: Aggregation, Composition, and Delegation
- 5.1.2. Strings and Characters
- 5.1.3. Check Your Understanding: Strings
- 5.1.4. Counter-controlled Loops
- 5.1.5. Check Your Understanding: Counter Controlled Loops
- 5.1.6. Tips on Random Numbers
- 5.1.7. Check Your Understanding: Random Numbers
- 5.1.8. Method Overriding
- 5.1.9. Check Your Understanding: Method Overriding
- 5.1.10. Syntax Practice 7
- 5.1.11. Programming Practice 7
Chapter 6 Grouping Objects Using Lists and Nested For Loops¶
- 6.1. Grouping Objects Using Lists and Nested For Loops
- 6.1.1. Collections of Objects
- 6.1.2. Interfaces
- 6.1.3. Check Your Understanding: Interfaces
- 6.1.4. The List Interface
- 6.1.5. Generics
- 6.1.6. ArrayList
- 6.1.7. Check Your Understanding: ArrayLists
- 6.1.8. Nested For Loops
- 6.1.9. Check Your Understanding: Nested For Loops
- 6.1.10. Syntax Practice 8
- 6.1.11. Programming Practice 8
- 6.1.12. Check Your Understanding
Chapter 7 Lists, Loop Idioms, Generics, and the Null Keyword¶
- 7.1. Lists, Loop Idioms, Generics, and the Null Keyword
- 7.1.1. Modelling the Contents of a Library
- 7.1.2. Looping Idioms
- 7.1.3. Check Your Understanding: Loop Idioms
- 7.1.4. Generics Revisited
- 7.1.5. Check Your Understanding: Generics
- 7.1.6. The Null Keyword
- 7.1.7. Diagnosing a Null Pointer Exception
- 7.1.8. Check Your Understanding: Null
- 7.1.9. Using BlueJ’s Debugger
- 7.1.10. Using BlueJ’s Code Pad
- 7.1.11. Syntax Practice 9
- 7.1.12. Programming Practice 9
Chapter 8 Arrays¶
- 8.1. Arrays
- 8.1.1. Creating An Array
- 8.1.2. Accessing Items in Arrays
- 8.1.3. Setting Items in an Array
- 8.1.4. Arrays Compared to Lists (or ArrayList)
- 8.1.5. Putting It All Together
- 8.1.6. Check Your Understanding: Arrays
- 8.1.7. Iterating Over Arrays
- 8.1.8. Check Your Understanding: Iterating with Arrays
- 8.1.9. Initializing Array Contents
- 8.1.10. Printing Arrays
- 8.1.11. Copying Array Variables
- 8.1.12. Naming Array Variables
- 8.1.13. Writing Test Assertions Involving Arrays
- 8.1.14. Applying Arrays in a Problem
- 8.1.15. Syntax Practice 10
- 8.1.16. Programming Practice 10
- 8.1.17. Check Your Understanding
Chapter 9 Multi-dimensional Arrays¶
- 9.1. Multi-dimensional Arrays
- 9.1.1. Dimensions in an Array
- 9.1.2. Check Your Understanding: 2D Arrays
- 9.1.3. Syntax Practice: 2D Array Basics
- 9.1.4. Iterating through a 2D Array
- 9.1.5. Check Your Understanding: Iterating with 2D Arrays
- 9.1.6. Syntax Practice: Looping Over 2D Arrays
- 9.1.7. Multi-Dimensional Arrays
- 9.1.8. Syntax Practice: 3D Arrays
- 9.1.9. But Can You Have Multi-dimensional Lists?
- 9.1.10. Integer Division and Modulus
- 9.1.11. Check Your Understanding: Modulus
- 9.1.12. Syntax Practice: Modulus
- 9.1.13. Programming Practice: Multi-dimensional Arrays
- 9.1.14. Programming Practice: Mod
Chapter 10 Input, Output and Variable Scoping¶
- 10.1. Input, Output and Variable Scoping
- 10.1.1. Variable Scoping
- 10.1.2. Check Your Understanding: Scope
- 10.1.3. Syntax Practice: Scoping
- 10.1.4. Java Input and Output
- 10.1.5. Output Using PrintWriters
- 10.1.6. Check Your Understanding: Output
- 10.1.7. Input Using Scanners
- 10.1.8. A Complete Input Example
- 10.1.9. Check Your Understanding: Input
- 10.1.10. A Complete Input/Output Example
- 10.1.11. Testing I/O-based Operations
- 10.1.12. Check Your Understanding: Testing
Chapter 11 Maps and Sets¶
- 11.1. Maps and Sets
- 11.1.1. The Map and Set Interfaces
- 11.1.2. The Map Interface
- 11.1.3. Syntax Practice: Making Maps
- 11.1.4. Adding and Accessing Pairs in a Map
- 11.1.5. Syntax Practice: Adding to Maps
- 11.1.6. Checking for and Removing Pairs in a Map
- 11.1.7. A Visual Summary of Using Map and HashMap
- 11.1.8. Syntax Practice: Map Contains and Remove
- 11.1.9. Looping Over Map Contents
- 11.1.10. Check Your Understanding: Maps
- 11.1.11. The Set Interface
- 11.1.12. Syntax Practice: Making A Set
- 11.1.13. Adding Values to a Set
- 11.1.14. Syntax Practice: Adding to a Set
- 11.1.15. Checking Values in a Set
- 11.1.16. Syntax Practice: Set Contains
- 11.1.17. Removing Values from a Set
- 11.1.18. Syntax Practice: Set Remove
- 11.1.19. Looping Over Sets
- 11.1.20. Check Your Understanding: Sets
- 11.1.21. Programming Practice: Maps
Chapter 12 Static, Main, and Exceptions¶
- 12.1. Static, Main, and Exceptions
- 12.1.1. The Main Method
- 12.1.2. Check Your Understanding: Main Methods
- 12.1.3. The Static Keyword
- 12.1.4. Check Your Understanding: The Static Keyword
- 12.1.5. Errors
- 12.1.6. Throwing Exceptions
- 12.1.7. Check Your Understanding: Throwing Exceptions
- 12.1.8. Syntax Practice: Throwing Exceptions
- 12.1.9. Try/Catch Blocks
- 12.1.10. Check Your Understanding: Try/Catch Blocks
- 12.1.11. Syntax Practice: Try-Catch Blocks