(Updated August 26, 2020) Table of contents Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7a Chapter 7b Chapter 8 Chapter 9 Chapter 9s Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15a Chapter 15b Chapter 16 Chapter 17 Chapter 18 Chapter 1 [Note: There are no … Read More “Java Exercise Answers” »
Category: Java Book
(Updated April 30, 2023) Table of contents Overview Basic Tree Red-Black Trees AVL Tree B-Tree Special-Purpose Tree Exercises Overview The tree data structure provides a means of implementing sorted data in the form of a modified linked list such that traversals are far less expensive and approach O(log2n). We say they approach because the tree … Read More “Chapter 18 – Trees” »
(Updated June 12, 2022) Table of contents Overview The Cloneable Interface The Comparable Interface Generic Methods Generic Classes Generic Data Structures Exercises Overview Much of the code we have dealt with up to this point has been geared toward a specific data type. For example, a particular method or even a class has often been … Read More “Chapter 17 – Generic Methods and Classes” »
(Updated June 12, 2022) Table of contents Overview Stacks Queues Deques (Double-Ended Queues) Exercises Overview This section takes linked lists into new territory. Remember that each data structure shown here is still a linked list. What is changing are the rules that govern how the object may be manipulated. Stacks Overview Stacks are a wondrous … Read More “Chapter 16 – Stack, Queues and Deques” »
(Updated April 5, 2024) Table of contents Overview Hashing Hash Table Hash Function Implementation Collision Resolution Load Factor Hash Map Improving Hashes Complete Examples Exercises Overview We have seen arrays and the power they possess. They can store vast amounts of knowledge, have complex operations, like sorting, and be relatively fast when using tools like … Read More “Chapter 15 – Hashing” »
(Updated March 19, 2023) Table of contents Overview The Linked List Building the LinkedList Class Iterators An IterableList Implementing remove() An Alternative Node Approach Exercises Overview When using arrays, we discovered the usefulness of collecting our data together under a single identifier name. Further, we enjoyed the simplicity of accessing the elements of the array … Read More “Chapter 14 – Linked Lists, Iterators” »
(Updated March 26, 2023) Table of contents Overview The Basics An Example Different Types of Recursion Another Example The Cost Memoization Exercises Overview We have previously determined that we often need to do some work while some condition exists or until some condition is met. This has always been handled using an iterative process, which … Read More “Chapter 13 – Recursion” »
(Updated June 10, 2022) Table of contents Overview Handling Exceptions The try/catch/finally Block The Exception Hierarchy Checked and Unchecked Exceptions Creating an Exception Class Exercises Overview When we develop a Java program, there are many opportunities to fix syntax and logic problems. Some possibilities are available through error messages from the compiler, which refuses to … Read More “Chapter 12 – Exceptions” »
Updated June 10, 2022 Table of contents Inheritance The Object Class Abstract Methods and Classes Interfaces Inheritance vs. Composition Exercises Inheritance Recall from our discussion on creating a GUI that we chose to use the phrase extends JFrame (for Swing) or extends Application (for JavaFX). This meant the class containing our program could obtain the … Read More “Chapter 11 – Inheritance and Polymorphism” »
(Updated December 3, 2022) Table of contents Overview Wrapper Classes – Revisited Autoboxing and Auto-Unboxing The Vector Class The ArrayList Class Enumerations Color Vector Part II The instanceof Operator Quiz Exercises Overview The use of arrays has opened up many possibilities for collecting related data together. This is just the beginning of collecting data of … Read More “Chapter 10 – Vector, ArrayList and Enumerations” »