Table of Contents

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 Why whitespace matters
1.11 Java example: Married-couple names

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.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.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.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: Annual salary tax rate calculation with arrays
5.12 Java example: Domain name validation with arrays

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.1 Objects: Introduction
7.2 Using a class
7.3 Defining a class
7.4 Mutators, accessors, and private helpers
7.5 Initialization and constructors
7.6 Choosing classes to create
7.7 Defining main() in a programmer-defined class
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 Wrapper class conversions
7.14 ArrayList
7.15 Classes and ArrayLists
7.16 ArrayList ADT
7.17 Parameters of reference types
7.18 Static fields and methods
7.19 Using packages
7.20 Java example: Salary calculation with classes
7.21 Java example: Domain name availability with classes

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 Abstract classes: Introduction (generic)
8.8 Abstract classes
8.9 Is-a versus has-a relationships
8.10 UML
8.11 Interfaces
8.12 Java example: Employees and instantiating from an abstract class
8.13 Java example: Employees and overriding class methods

9.1 Recursion: Introduction
9.2 Recursive methods
9.3 Recursive algorithm: Search
9.4 Adding output statements for debugging
9.5 Creating a recursive method
9.6 Recursive math methods
9.7 Recursive exploration of all possibilities
9.8 Stack overflow
9.9 Java example: Recursively output permutations

10.1 Exception basics
10.2 Exceptions with methods
10.3 Multiple handlers
10.4 Exception handling in file input/output
10.5 Java example: Generate number format exception

11.1 Searching and algorithms
11.2 Binary search
11.3 O notation
11.4 Algorithm analysis
11.5 Sorting: Introduction
11.6 Selection sort
11.7 Insertion sort
11.8 Quicksort
11.9 Merge sort

12.1 String operations problem
12.2 Black and white problem
12.3 String search problem
12.4 Palindrome problem
12.5 Sentence splitter problem
12.6 Sentence manager problem

13.1 Array madness problem
13.2 Encryption problem
13.3 Number changer problem
13.4 Daily quizzes problem

14.1 Array checker problem
14.2 Array words problem
14.3 Dice game problem
14.4 FillerUp problem
14.5 Map reader problem

15.1 Baseball player problem
15.2 Flight schedule problem
15.3 Friends problem
15.4 The office problem
15.5 Help, I’m trapped! problem
15.6 Phone contacts problem
15.7 Gamer bug problem

16.1 Flip flop problem
16.2 Array MinMax problem
16.3 Number properties problem
16.4 Nuts and bolts problem
16.5 Time gaps problem
16.6 Random dice problem

17.1 Magazine problem
17.2 Map problem
17.3 Music song problem
17.4 Rectangle problem

18.1 Cat problem
18.2 Shapes problem
18.3 Secrets problem

19.1 Introduction to memory management
19.2 A first linked list
19.3 Memory regions: Heap/Stack
19.4 Basic garbage collection
19.5 Garbage collection and variable scope
19.6 Java example: Employee list using ArrayLists

20.1 Output and input streams
20.2 Output formatting
20.3 Streams using Strings
20.4 File input
20.5 File output

21.1 Comparable Interface: Sorting an ArrayList
21.2 Generic methods
21.3 Class generics
21.4 Java example: Map values using a generic method

22.1 Enhanced for loop
22.2 List: LinkedList
22.3 Map: HashMap
22.4 Set: HashSet
22.5 Queue interface
22.6 Deque interface

23.1 Basic graphics
23.2 Introduction to graphical user interfaces
23.3 Positioning GUI components using a GridBagLayout
23.4 GUI input and ActionListeners
23.5 GUI input with formatted text fields
23.6 GUI input with JSpinners
23.7 Displaying multi-line text in a JTextArea
23.8 Using tables in GUIs
23.9 Using sliders in GUIs
23.10 GUI tables, fields, and buttons: A seat reservation example
23.11 Reading files with a GUI

24.1 Introduction to graphical user interfaces with JavaFX
24.2 Positioning GUI components using a GridPane
24.3 Input and event handlers
24.4 Basic graphics with JavaFX

25.1 Switch statements
25.2 Conditional expressions
25.3 Do-while loops
25.4 Enumerations
25.5 Engineering examples
25.6 Engineering examples using methods
25.7 Command-line arguments
25.8 Command-line arguments and files
25.9 Java documentation for methods
25.10 Java documentation for classes
25.11 Additional practice: Output art
25.12 Additional practice: Grade calculation
25.13 Additional practice: Tweet decoder
25.14 Additional practice: Dice statistics
25.15 zyBooks built-in programming window

Teach Java with this hands-on, interactive zyBook

AP Computer Science A (Java) is an introduction to programming foundations and Java, based on the AP curriculum and exam.

  • Auto-graded challenge activities using an integrated programming environment
  • Packed with over 600 interactive coding exercises and learning activities to help students master the material
  • Dozens of problems for practicing APCSA exam questions
  • Configurable sections support early/late introduction to methods and objects
  • Additional material includes engineering examples and Javadocs
  • Adopters have access to a test bank with questions for every chapter

What is a zyBook?


AP Computer Science A (Java) is a web-native, interactive zyBook that helps students visualize concepts to learn faster and more effectively than with a traditional textbook. (Check out our research.)

Since 2012, over 1,700 academic institutions have adopted digital zyBooks to transform their STEM education.

zyBooks utilize the “Say, Show, Ask” approach

Say. We use concise text as a jumping board for our animations and learning questions.
Show. Much of a traditional textbook is replaced with animations to help students visualize key concepts.
Ask. Learning questions and auto-graded homework problems encouraged more student participation.

Authors

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

Adrian Lizarraga
Electrical and Computer Engineering PhD, Univ. of Arizona / zyBooks

Instructors: Interested in evaluating this zyBook for your class?