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 Integrated development environment
1.7 Computer tour
1.8 Language history
1.9 Problem solving
1.10 Why programming
1.11 Why whitespace matters
1.12 Java example: Married-couple names
2. Basic Objects
2.1 Objects: An early introduction (EO)
2.2 Variables and assignments (general)
2.3 Variables (int)
2.4 Identifiers
2.5 Arithmetic expressions (general)
2.6 Arithmetic expressions (int)
2.7 Example: Health data
2.8 Floating-point numbers (double)
2.9 Scientific notation for floating-point literals
2.10 Comments and whitespace
2.11 Calling methods (EO)
2.12 Constructing objects (EO)
2.13 Accessors and mutators (EO)
2.14 Reading API documentation
2.15 Debugging
2.16 Basic graphics
2.17 Style guidelines
2.18 Java example: Salary calculation with variables
3. Basic Methods + Classes
3.1 Using a class
3.2 Defining a class
3.3 Defining main() in a programmer-defined class
3.4 User-defined method basics (EO)
3.5 Return (EO)
3.6 Reasons for defining methods (EO)
3.7 Unit testing (classes)
3.8 The ‘this’ implicit parameter
3.9 Java documentation for classes
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. Branches
5.1 If-else branches (general)
5.2 Detecting equal values with branches
5.3 Detecting ranges with branches (general)
5.4 Detecting ranges with branches
5.5 Detecting ranges using logical operators
5.6 Detecting ranges with gaps
5.7 Detecting multiple features with branches
5.8 Common branching errors
5.9 Example: Toll calculation
5.10 Order of evaluation
5.11 Example: A SimpleCar class (EO)
5.12 Switch statements
5.13 Boolean data type
5.14 String comparisons
5.15 String access operations
5.16 Character operations
5.17 Finding and replacing text with a string
5.18 Conditional expressions
5.19 Floating-point comparison
5.20 Short circuit evaluation
5.21 Java example: Salary calculation with branches
5.22 Java example: Search for name using branches
6. Loops
6.1 Loops (general)
6.2 While loops
6.3 More while examples
6.4 For loops
6.5 More for loop examples
6.6 Loops and strings
6.7 Nested loops
6.8 Developing programs incrementally
6.9 Break and continue
6.10 Variable name scope
6.11 Enumerations
6.12 Java example: Salary calculation with loops
6.13 Java example: Domain name validation with loops
7. Arrays
7.1 Array concept (general)
7.2 Arrays
7.3 Array iteration drill
7.4 Iterating through arrays
7.5 Multiple arrays
7.6 Swapping two variables (General)
7.7 Loop-modifying or copying/comparing arrays
7.8 Debugging example: Reversing an array
7.9 Two-dimensional arrays
7.10 Enhanced for loop: Arrays
7.11 Java example: Annual salary tax rate calculation with arrays
7.12 Java example: Domain name validation with arrays
8. Methods Continued
8.1 Methods with branches/loops (EO)
8.2 Unit testing methods (EO)
8.3 How methods work
8.4 Methods: Common errors (EO)
8.5 Array parameters (EO)
8.6 Scope of variable/method definitions (EO)
8.7 Method name overloading (EO)
8.8 Parameter error checking
8.9 Using Scanner in methods
8.10 Java documentation for methods
8.11 Java example: Salary calculation with methods
8.12 Java example: Domain name validation with methods
9. Classes Continued
9.1 Mutators, accessors, and private helpers
9.2 Initialization and constructors
9.3 Constructor overloading
9.4 Objects and references
9.5 Abstract data types: Introduction (EO)
9.6 Primitive and reference types
9.7 Wrapper class conversions
9.8 ArrayList
9.9 Classes, ArrayLists, and methods: A seat reservation example (EO)
9.10 Choosing classes to create
9.11 ArrayList ADT (EO)
9.12 Parameters of reference types (EO)
9.13 Static fields and methods
9.14 Using packages
9.15 Java example: Salary calculation with classes
9.16 Java example: Domain name availability with classes (EO)
10. Inheritance
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.11 Interfaces
10.12 Java example: Employees and overriding class methods
10.13 Java example: Employees and instantiating from an abstract class
11. Generics
11.1 Generic methods
11.2 Generic methods and type bounds
11.3 Generic classes
11.4 Generic classes with type bounds
11.5 Comparable Interface: Sorting an ArrayList
11.4 Java example: Map values using a generic method
12. Collections
12.1 Enhanced for loop
12.2 List: LinkedList
12.3 Map: HashMap
12.4 Set: HashSet
12.5 Queue interface
12.6 Deque interface
13. GUI
13.1 Introduction to graphical user interfaces
13.2 Positioning GUI components using a GridBagLayout
13.3 GUI input and ActionListeners
13.4 GUI input with formatted text fields
13.5 GUI input with JSpinners
13.6 Displaying multi-line text in a JTextArea
13.7 Using tables in GUIs
13.8 Using sliders in GUIs
13.9 GUI tables, fields, and buttons: A seat reservation example
13.10 Reading files with a GUI
14. JavaFX
14.1 Introduction to graphical user interfaces with JavaFX
14.2 Positioning GUI components using a GridPane
14.3 Input and event handlers
14.4 Basic graphics with JavaFX
15. Input / Output
15.1 Output and input streams
15.2 Output formatting
15.3 Streams using Strings
15.4 File input
15.5 File output
16. Exceptions
16.1 Handling exceptions
16.2 Throwing exceptions
16.3 Exceptions with files
16.4 Exceptions with methods
16.5 User-defined exceptions
16.6 Java example: Generate number format exception
17. Recursion
17.1 Recursion: Introduction
17.2 Recursive methods
17.3 Recursive algorithm: Search
17.4 Adding output statements for debugging
17.5 Creating a recursive method
17.6 Recursive math methods
17.7 Recursive exploration of all possibilities
17.8 Stack overflow
17.9 Java example: Recursively output permutations
18. Memory Management
18.1 Introduction to memory management
18.2 A first linked list
18.3 Memory regions: Heap/Stack
18.4 Basic garbage collection
18.5 Garbage collection and variable scope
18.6 Java example: Employee list using ArrayLists
19. Searching and Sorting Algorithms
19.1 Searching and algorithms
19.2 Binary search
19.3 O notation
19.4 Algorithm analysis
19.5 Sorting: Introduction
19.6 Selection sort
19.7 Insertion sort
19.8 Quicksort
19.9 Merge sort
20. Additional Material
20.1 Do-while loops
20.2 Example: A Dice Game (EO)
20.3 Engineering examples
20.4 Engineering examples using Methods (EO)
20.5 Command-line arguments
20.6 Command-line arguments and files
20.7 Perfect size arrays
20.8 Oversize arrays
20.9 Methods with oversize arrays
20.10 Comparing perfect size and oversize arrays
20.11 Using references in methods
20.12 Returning arrays from methods
20.13 Common errors: Methods and arrays
20.14 Additional practice: Output art
20.15 Additional practice: Grade calculation
20.16 Additional practice: Abbreviation decoder (note: new)
20.17 Additional practice: Dice statistics
20.18 zyBooks built-in programming window
Teach Java EO with this hands-on, interactive zyBook, now updated with advanced zyLabs
Java Early Objects 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
- Customizable so instructors can reorganize, edit, and add their own learning content
- Adopters have access to a test bank with over 600 questions
What is a zyBook?
Java Early Objects 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 programming environment
See the advanced zyLabs capabilities:
Authors
Roman Lysecky
Professor Emeritus of Electrical and Computer Engineering, Univ. of Arizona
Adrian Lizarraga
Electrical and Computer Engineering PhD, Univ. of Arizona / zyBooks