Table of Contents

1. Introduction to Java

1.1 Programming (general)
1.2 Programming basics
1.3 Comments and whitespace
1.4 Errors and warnings
1.5 Computers and programs (general)
1.6 Computer tour
1.7 Language history
1.8 Problem solving
1.9 Why programming
1.10 Java example: Salary calculation
1.11 Java example: Married-couple names

2. Variables / Assignments

2.1 Variables and assignments (general)
2.2 Variables (int)
2.3 Identifiers
2.4 Arithmetic expressions (general)
2.5 Arithmetic expressions (int)
2.6 Example: Health data
2.7 Floating-point numbers (double)
2.8 Scientific notation for floating-point literals
2.9 Constant variables
2.10 Using math methods
2.11 Integer division and modulo
2.12 Type conversions
2.13 Binary
2.14 Characters
2.15 Strings
2.16 Integer overflow
2.17 Numeric data types
2.18 Random numbers
2.19 Reading API documentation
2.20 Debugging
2.21 Style guidelines
2.22 Java example: Salary calculation with variables
2.23 Java example: Married-couple names with variables

4. Loops

4.1 Loops (general)
4.2 While loops
4.3 More while examples
4.4 For loops
4.5 More for loop examples
4.6 Loops and strings
4.7 Nested loops
4.8 Developing programs incrementally
4.9 Break and continue
4.10 Variable name scope
4.11 Java example: Salary calculation with loops
4.12 Java example: Domain name validation with loops

4. Data Types

4.1 Constant variables
4.2 Using math methods
4.3 Integer division and modulo
4.4 Type conversions
4.5 Binary
4.6 Characters
4.7 Strings
4.8 Integer overflow
4.9 Numeric data types
4.10 Random numbers
4.11 Java example: Married-couple names with variables

5. Arrays

5.1 Array concept (general)
5.2 Arrays
5.3 Array iteration drill
5.4 Iterating through arrays
5.5 Multiple arrays
5.6 Swapping two variables (General)
5.7 Loop-modifying or copying/comparing arrays
5.8 Debugging example: Reversing an array
5.9 Two-dimensional arrays
5.10 Enhanced for loop: Arrays
5.11 Java example: Salary calculation with arrays
5.12 Java example: Domain name validation with arrays

6. User-Defined Methods

6.1 User-defined method basics
6.2 Return
6.3 Reasons for defining methods
6.4 Methods with branches/loops
6.5 Unit testing (methods)
6.6 How methods work
6.7 Methods: Common errors
6.8 Array parameters
6.9 Scope of variable/method definitions
6.10 Method name overloading
6.11 Parameter error checking
6.12 Using Scanner in methods
6.13 Perfect size arrays
6.14 Oversize arrays
6.15 Methods with oversize arrays
6.16 Comparing perfect size and oversize arrays
6.17 Using references in methods
6.18 Returning arrays from methods
6.19 Common errors: Methods and arrays
6.20 Java example: Salary calculation with methods
6.21 Java example: Domain name validation with methods

7. Objects and Classes

7.1 Objects: Introduction
7.2 Using a class
7.3 Defining a class
7.7 Defining main() in a programmer-defined class
7.4 Mutators, accessors, and private helpers
7.5 Initialization and constructors
7.6 Choosing classes to create
7.8 Unit testing (classes)
7.9 Constructor overloading
7.10 Objects and references
7.11 The ‘this’ implicit parameter
7.12 Primitive and reference types
7.13 ArrayList
7.14 Classes, ArrayLists, and methods: A seat reservation example
7.15 ArrayList ADT
7.16 Parameters of reference types
7.17 Static fields and methods
7.18 Java example: Salary calculation with classes
7.19 Java example: Domain name availability with classes

8. Inheritance

8.1 Derived classes
8.2 Access by members of derived classes
8.3 Overriding member methods
8.4 The Object class
8.5 Polymorphism
8.6 ArrayLists of Objects
8.7 Is-a versus has-a relationships
8.8 Java example: Employees and overriding class methods

9. Abstract Class and Interfaces

9.1 Abstract classes: Introduction
9.2 Abstract classes
9.3 UML for abstract classes
9.4 Abstract classes and polymorphism
9.5 Interfaces
9.6 Java example: Employees and instantiating from an abstract class

10. Recursion

10.1 Recursion: Introduction
10.2 Recursive methods
10.3 Recursive algorithm: Search
10.4 Adding output statements for debugging
10.5 Creating a recursive method
10.6 Recursive math methods
10.7 Recursive exploration of all possibilities
10.8 Stack overflow
10.9 Java example: Recursively output permutations

11. Exceptions

11.1 Exception basics
11.2 Exceptions with methods
11.3 Multiple handlers
11.4 Exception handling in file input/output
11.5 Java example: Generate number format exception

12. Searching and Sorting Alg.

12.1 Searching and algorithms (Java)
12.2 Binary search (Java)
12.3 O notation
12.4 Algorithm analysis
12.5 Sorting: Introduction
12.6 Selection sort (Java)
12.7 Insertion sort (Java)
12.8 Quicksort (Java)
12.9 Merge sort (Java)

13. AP Java: Strings

13.1 String operations problem
13.2 Black and white problem
13.3 String search problem
13.4 Palindrome problem
13.5 Sentence splitter problem
13.6 Sentence manager problem

14. AP Java: Arrays

14.1 Array madness problem
14.2 Encryption problem
14.3 Number changer problem
14.4 Daily quizzes problem

15. AP Java: 2D Arrays

15.1 Array checker problem
15.2 Array words problem
15.3 Dice game problem
15.4 FillerUp problem
15.5 Map reader problem

16. AP Java: ArrayList

16.1 Baseball player problem
16.2 Flight schedule problem
16.3 Friends problem
16.4 The office problem
16.5 Help, I’m trapped! problem
16.6 Phone contacts problem
16.7 Gamer bug problem

17. AP Java: Numbers

17.1 Flip flop problem
17.2 Array MinMax problem
17.3 Number properties problem
17.4 Nuts and bolts problem
17.5 Time gaps problem
17.6 Random dice problem

18. AP Java: Classes

18.1 Magazine problem
18.2 Map problem
18.3 Music song problem
18.4 Rectangle problem

19. AP Java: Inheritence

19.1 Cat problem
19.2 Shapes problem
19.3 Secrets problem

20. Memory Management

20.1 Introduction to memory management
20.2 A first linked list
20.3 Memory regions: Heap/Stack
20.4 Basic garbage collection
20.5 Garbage collection and variable scope
20.6 Java example: Employee list using ArrayLists

21. Input / Output

21.1 OutputStream and System.out
21.2 InputStream and System.in
21.3 Output formatting
21.4 Streams using Strings
21.5 File input and output

22. Generics

22.1 Comparable Interface: Sorting an ArrayList
22.2 Generic methods
22.3 Class generics
22.4 Java example: Map values using a generic method

23. Collections

23.1 Enhanced for loop
23.2 List: LinkedList
23.3 Map: HashMap
23.4 Set: HashSet
23.5 Queue interface
23.6 Deque interface

24. GUI

4.1 Basic graphics
24.2 Introduction to graphical user interfaces
24.3 Positioning GUI components using a GridBagLayout
24.4 GUI input and ActionListeners
24.5 GUI input with formatted text fields
24.6 GUI input with JSpinners
24.7 Displaying multi-line text in a JTextArea
24.8 Using tables in GUIs
24.9 Using sliders in GUIs
24.10 GUI tables, fields, and buttons: A seat reservation example
24.11 Reading files with a GUI

25. JavaFX

25.1 Introduction to graphical user interfaces with JavaFX
25.2 Positioning GUI components using a GridPane
25.3 Input and event handlers
25.4 Basic graphics with JavaFX

26. Additional Material

26.1 Switch statements
26.2 Conditional expressions
26.3 Do-while loops
26.4 Enumerations
26.5 Engineering examples
26.6 Engineering examples using methods
26.7 Command-line arguments
26.8 Command-line arguments and files
26.9 Java documentation for methods
26.10 Java documentation for classes
26.11 Additional practice: Output art
26.12 Additional practice: Grade calculation
26.13 Additional practice: Tweet decoder
26.14 Additional practice: Dice statistics
26.15 zyBooks built-in programming window

Toggle Title

22. Generics
22.1 Comparable Interface: Sorting an ArrayList
22.2 Generic methods
22.3 Class generics
22.4 Java example: Map values using a generic method

23. Collections
23.1 Enhanced for loop
23.2 List: LinkedList
23.3 Map: HashMap
23.4 Set: HashSet
23.5 Queue interface
23.6 Deque interface

24. GUI
24.1 Basic graphics
24.2 Introduction to graphical user interfaces
24.3 Positioning GUI components using a GridBagLayout
24.4 GUI input and ActionListeners
24.5 GUI input with formatted text fields
24.6 GUI input with JSpinners
24.7 Displaying multi-line text in a JTextArea
24.8 Using tables in GUIs
24.9 Using sliders in GUIs
24.10 GUI tables, fields, and buttons: A seat reservation example
24.11 Reading files with a GUI

25. JavaFX
25.1 Introduction to graphical user interfaces with JavaFX
25.2 Positioning GUI components using a GridPane
25.3 Input and event handlers
25.4 Basic graphics with JavaFX

26. Additional Material
26.1 Switch statements
26.2 Conditional expressions
26.3 Do-while loops
26.4 Enumerations
26.5 Engineering examples
26.6 Engineering examples using methods
26.7 Command-line arguments
26.8 Command-line arguments and files
26.9 Java documentation for methods
26.10 Java documentation for classes
26.11 Additional practice: Output art
26.12 Additional practice: Grade calculation
26.13 Additional practice: Tweet decoder
26.14 Additional practice: Dice statistics
26.15 zyBooks built-in programming window

What You’ll Find In This zyBook:

More action with less text.

  • ~600 participation activities: Questions, animations, tools
  • ~100 auto-graded programming challenge activities using built-in programming environment
  • Dozens of problems for practicing AP exam questions
  • Configurable sections support early/late introduction to methods and objects
  • Additional material includes engineering examples and Javadocs

Instructors: Interested in evaluating this zyBook for your class? Sign up for a Free Trial and check out the first chapter of any zyBook today!

The zyBooks Approach

Less text doesn’t mean less learning.

Provides interactive learning of programming foundations and Java. Emphasizes a solid understanding of memory. From the moment variables are introduced, the material shows via animations how variables exist and are updated in memory. The continued showing of memory helps clarify challenging topics like pass-by-copy/reference parameters, object creation, garbage collection, and more. Furthermore, the material includes emphasis on disciplined program development, including incremental development, modular development, and testing/debugging. This material is a re-ordering of the “Programming in Java” zyBook customized for the AP Computer Science curriculum and exam. The zyBook additionally includes dozens of problems for practicing AP exam questions.

“The most striking aspect of ZyBooks for me as an instructor has been the ability to introduce a topic and then point my students to specific exercises/activities in ZyBooks that would not only expound on the concept but allow them to practice them with confidence.”

Ramesh YerraballiSenior Lecturer Dept. of Electrical & Comp Engrs, UT Austin

Authors

Roman Lysecky
Professor of Electrical and Computer Engineering, Univ. of Arizona

Adrian Lizarraga
zyBooks, ECE Ph, D., University of Arizona

Combine AP Java With These Other zyBooks

AP Java is often combined with other zyBooks to give students experience with a diverse set of programming languages. Some popular titles to pair with AP Java include: