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

3.1 If-else branches (general)
3.2 If-else
3.3 More if-else
3.4 Equality and relational operators
3.5 Detecting ranges (general)
3.6 Detecting ranges with if-else statements
3.7 Logical operators
3.8 Order of evaluation
3.9 Example: Toll calculation
3.10 Switch statements
3.11 Boolean data type
3.12 String comparisons
3.13 String access operations
3.14 Character operations
3.15 More string operations
3.16 Conditional expressions
3.17 Floating-point comparison
3.18 Short circuit evaluation
3.19 Java example: Salary calculation with branches
3.20 Java example: Search for name using branches

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 Enumerations
4.12 Java example: Salary calculation with loops
4.13 Java example: Domain name validation with loops

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 documentation for methods
6.21 Java example: Salary calculation with methods
6.22 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 Java documentation for classes
7.18 Parameters of reference types
7.19 Static fields and methods
7.20 Using packages
7.21 Java example: Salary calculation with classes
7.22 Java example: Domain name availability with classes

8.1 Introduction to memory management
8.2 A first linked list
8.3 Memory regions: Heap/Stack
8.4 Basic garbage collection
8.5 Garbage collection and variable scope
8.6 Java example: Employee list using ArrayLists

9.1 Output and input streams
9.2 Output formatting
9.3 Streams using Strings
9.4 File input
9.5 File output

10.1 Derived classes
10.2 Access by members of derived classes
10.3 Overriding member methods
10.4 The Object class
10.5 Polymorphism
10.6 ArrayLists of Objects
10.7 Abstract classes: Introduction (generic)
10.8 Abstract classes
10.9 Is-a versus has-a relationships
10.10 UML
10.12 Interfaces
10.13 Java example: Employees and instantiating from an abstract class
10.11 Java example: Employees and overriding class methods

11.1 Recursion: Introduction
11.2 Recursive methods
11.3 Recursive algorithm: Search
11.4 Adding output statements for debugging
11.5 Creating a recursive method
11.6 Recursive math methods
11.7 Recursive exploration of all possibilities
11.8 Stack overflow
11.9 Java example: Recursively output permutations

12.1 Exception basics
12.2 Exceptions with methods
12.3 Multiple handlers
12.4 Exception handling in file input/output
12.5 Java example: Generate number format exception

13.1 Comparable Interface: Sorting an ArrayList
13.2 Generic methods
13.3 Class generics
13.4 Java example: Map values using a generic method

14.1 Enhanced for loop
14.2 Map: HashMap
14.3 Set: HashSet
14.4 List: LinkedList
14.5 Queue interface
14.6 Deque interface

15.1 Basic graphics
15.2 Introduction to graphical user interfaces
15.3 Positioning GUI components using a GridBagLayout
15.4 GUI input and ActionListeners
15.5 GUI input with formatted text fields
15.6 GUI input with JSpinners
15.7 Displaying multi-line text in a JTextArea
15.8 Using tables in GUIs
15.9 Using sliders in GUIs
15.10 GUI tables, fields, and buttons: A seat reservation example
15.11 Reading files with a GUI

16.1 Introduction to graphical user interfaces with JavaFX
16.2 Positioning GUI components using a GridPane
16.3 Input and event handlers
16.4 Basic graphics with JavaFX

17.1 Searching and algorithms
17.2 Binary search
17.3 O notation
17.4 Algorithm analysis
17.5 Sorting: Introduction
17.6 Selection sort
17.7 Insertion sort
17.8 Quicksort
17.9 Merge sort

18.1 Do-while loops
18.2 Engineering examples
18.3 Engineering examples using methods
18.4 Command-line arguments
18.5 Command-line arguments and files
18.6 Additional practice: Output art
18.7 Additional practice: Grade calculation
18.8 Additional practice: Tweet decoder
18.9 Additional practice: Dice statistics
18.10 zyBooks built-in programming window

Teach Java with this hands-on, interactive zyBook, now updated with Advanced zyLabs

Programming in Java is a comprehensive introduction to the principles and practice of Java programming, based on the latest standards.

  • Covers foundational constructs, like branches, loops and functions, and advanced topics, like inheritance, exceptions and plotting
  • Packed with over 600 interactive coding exercises and learning activities to help students master the material
  • Completely customizable so instructors can reorganize, edit and add their own learning content
  • Adopters have access to a test bank with questions for every chapter

We developed our “say, show, ask” pedagogy – minimal text, interactive animations, and embedded questions – to foster active learning that really engages students.

What is a zyBook?

Programming in 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 insitutions have adopted digital zyBooks to transform their STEM education.

The zyBooks Programming Environment

See the new Advanced zyLabs capabilities:


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

Adrian Lizarraga
Ph.D. in Electrical & Computer Engineering, Univ. of Arizona / zyBooks