The Java Textbook

Quick reference

Every chapter's objectives in one place. Use it to find where you are: scan for the first row you cannot honestly claim, and start there.

objects-and-methods

ChapterYou should be able toStandard
Primitives
  • Predict the result of integer division and modulus
  • Explain when a cast is needed and where to put it
  • Recognise integer overflow
  • Say why floating-point comparisons fail
java21

selection-and-iteration

ChapterYou should be able toStandard
Boolean expressions
  • Evaluate a compound boolean expression by hand
  • Explain what short-circuit evaluation does and when it matters
  • Apply De Morgan's laws to simplify a negated condition
  • Avoid the == versus .equals trap on objects
java21
Loops
  • Trace a loop by hand and produce its output
  • Count how many times a loop body executes
  • Convert between for and while
  • Recognise the off-by-one and the infinite loop
java21

class-creation

ChapterYou should be able toStandard
Writing a class
  • Write fields, constructors, accessors and mutators from a specification
  • Use this to disambiguate a parameter from a field
  • Explain what private buys and why the exam insists on it
  • Write toString and know when it is called
java21

data-collections

ChapterYou should be able toStandard
Arrays
  • Declare, create and initialise an array
  • Traverse an array with both loop forms and know when each is usable
  • Avoid ArrayIndexOutOfBoundsException at both ends
  • Explain why an array parameter can be modified by a method
java21
ArrayList
  • Use the ArrayList methods the exam tests
  • Explain why an ArrayList holds objects rather than primitives
  • Remove elements while iterating without skipping any
  • Choose between an array and an ArrayList
java21
2-D arrays
  • Declare and traverse a 2-D array in row-major order
  • Use the correct length for rows and columns
  • Traverse by column when a problem requires it
  • Explain why Java has no true 2-D array
java21
Search and sort
  • Implement linear and binary search
  • State the precondition binary search requires
  • Trace selection and insertion sort after a given number of passes
  • Compare the algorithms by number of comparisons
java21
Recursion
  • Identify the base case and the recursive case
  • Trace a recursive call by hand and produce its output
  • Explain why a missing base case causes StackOverflowError
  • Recognise recursion over arrays and strings
java21

the-exam

ChapterYou should be able toStandard
Free response
  • Recognise the four free-response types
  • Write an answer that collects partial credit
  • Avoid the errors that lose points on correct code
  • Budget time across the section
java21