Computer ScienceJava with BlueJ Part 2
Not rated yetRate this bookJava with BlueJ Part 2 by Ron McFadyen extends introductory programming through arrays, text handling, enums, hierarchies, interfaces, files, exceptions, recursion, and algorithms. Its ten chapters assume knowledge of variables, control flow, methods, and classes. BlueJ makes experimentation accessible, but the reasoning transfers to other development environments. Work with diagrams, explicit contracts, and test cases. The goal is not only running code: you should be able to explain its state changes, dependencies, termination, and response to invalid or unexpected input.
Free reading is available at the official source. Opens in a new tab.
FreeAbout this book
Java with BlueJ Part 2 by Ron McFadyen extends introductory programming through arrays, text handling, enums, hierarchies, interfaces, files, exceptions, recursion, and algorithms. Its ten chapters assume knowledge of variables, control flow, methods, and classes. BlueJ makes experimentation accessible, but the reasoning transfers to other development environments. Work with diagrams, explicit contracts, and test cases. The goal is not only running code: you should be able to explain its state changes, dependencies, termination, and response to invalid or unexpected input.
Cover: original Academic Master reading-guide design. The linked source remains the edition described above.
Book summary
Java with BlueJ Part 2 by Ron McFadyen extends introductory programming through arrays, text handling, enums, hierarchies, interfaces, files, exceptions, recursion, and algorithms. Its ten chapters assume knowledge of variables, control flow, methods, and classes. BlueJ makes experimentation accessible, but the reasoning transfers to other development environments. Work with diagrams, explicit contracts, and test cases. The goal is not only running code: you should be able to explain its state changes, dependencies, termination, and response to invalid or unexpected input.
Chapter-by-chapter summaries
1. One-dimensional arrays
A fixed-length indexed sequence requires attention to length, valid positions, initialization, and traversal. Trace an empty, one-element, and longer array. Distinguish the reference from its contents when passing it to a method. State what a loop has established after processing each element. This connects aggregation and search with correctness rather than relying on a successful example. Boundary calculations should follow the actual range, not trial-and-error changes to comparison operators.
2. Arrays of arrays
Java permits inner arrays of different lengths, so a rectangular matrix is only one possible arrangement. Nested loops must use the current row’s actual bounds. Draw outer and inner references, including an unallocated or empty row where permitted. Explain what rows and columns mean before choosing traversal order. A test using only a square matrix can conceal invalid assumptions that become visible immediately when row lengths differ.
3. Validation and text manipulation
Text must satisfy a specification before conversion and use. Empty input, whitespace, signs, digits, and malformed strings require distinct cases. Separate checking representation from converting a value and performing the calculation. Build a test table with legitimate, boundary, and invalid cases. A validator can be wrong by accepting a misleading prefix or rejecting a valid alternative. Explain every rule through the intended input contract rather than an ad hoc collection of character tests.
4. Enumeration classes
Enums express a fixed set of named values more clearly than arbitrary integers or strings. Type checking can exclude invalid states, and names reveal meaning. Compare enum-based conditions and method signatures with numeric-code versions. Use an enum when the domain is appropriately closed; categories requiring runtime user extension may need another representation. The benefit is a clearer model and contract, not merely shorter typing or a replacement for all string values.
5. Hierarchies
Inheritance supports shared behaviour and specialization, with overriding and dynamic dispatch allowing general references to invoke specific implementations. Trace declared type and runtime class separately. A subtype should respect expectations attached to the parent. Reuse alone does not justify inheritance when one object merely uses another. Compare composition with a hierarchy for the same problem. The test is whether the relationship and behavioural promises make sense, not whether duplicate lines disappear.
6. Interfaces
Interfaces specify capabilities that different classes can supply without sharing one implementation hierarchy. Write a client method depending on the required behaviour and test two implementations. Identify guarantees available to the caller and details that remain private. Group coherent responsibilities rather than unrelated operations. This supports flexibility while retaining explicit contracts: implementations can differ internally, but substituting one should not require client code to rely on hidden assumptions about the concrete class.
7. Files
Persistent data introduces format, ordering, encoding, resource, and failure questions. Define a simple record structure, write sample data, and verify reconstruction. Opening a file successfully does not establish that its contents are complete or valid. Test missing sources, malformed records, and partial information. Keep parsing separate from the core model where practical. Persistence is trustworthy when round-trip behaviour preserves the intended information, including edge cases rather than only a trivial demonstration.
8. Exception handling
Exceptions interrupt normal execution and should be handled where sufficient context exists to respond meaningfully. Catching and continuing blindly can conceal broken assumptions. Compare validation with recovery from environmental failures that cannot be ruled out. Trace propagation through nested calls and preserve useful diagnostics. Manage resources even on failure. Distinguish anticipated exceptional conditions from defects that should be corrected, avoiding a broad handler that makes every problem appear to be successful completion.
9. Recursion
Recursive solutions require base cases and progress toward them. Each call owns its parameters and local state, so stack diagrams clarify intermediate computations and returns. Trace a small example completely, then compare an iterative version. Evaluate clarity, termination, and resource demands rather than treating recursion as automatically elegant or inefficient. A decreasing number is one possible progress measure; the essential requirement is a well-founded reduction that cannot continue indefinitely without reaching a base case.
10. Sorting and searching
Algorithm choice depends on representation, ordering, and required operations. Binary search requires suitable ordering and cannot be justified on arbitrary input. Trace short lists with duplicates and define what success or failure means. Compare growth in work as input increases rather than trusting one timing run. Sorting changes the conditions available to later searches, so assess preparation cost alongside lookup cost. Verify ordering consistently across comparison and search operations.
Study instructions
- Use interactive BlueJ experiments, then convert them into repeatable test programs.
- Draw references and hierarchy dispatch before executing examples.
- Maintain boundary cases for input, arrays, files, recursion, and searches.
- Build a file-backed collection application using interfaces, validation, meaningful exceptions, and a justified search method.
Questions for reflection
- Why can rows in an array of arrays differ in length?
- When is composition preferable to inheritance?
- What precondition makes binary search valid?
Sources and coverage
This original reading guide covers the linked edition’s main chapters, or the principal sections of its two-chapter calculus text. Consult the source for full arguments, cases, worked examples, exercises, illustrations, and references. Read the source edition.
This page provides book information and study material. Full-text access is provided by the original publisher or authorised source; a listing does not grant permission to republish the book.
Read our Library Access & Copyright policyExplore the contents
Check the chapters covered in this edition.
Visit the official source
See reading, preview or purchase options.
Save for later
Keep this textbook in your saved collection.
Reader ratings & reviews
Share your thoughts
Your review helps other students choose the right resources.









