Course web page: Introduction to Computer Science for Majors II by James Tam

Return to the course web page

Example Programs: Advanced Java

Description

File name

A useful method for displaying the state of an object ('toString')

firstExampleToString.zip

A method to compare the state of two objects ('equals')

secondExampleEquals.zip

Passing simple types as method parameters

thirdExampleValueParameters.zip

Passing references to methods

fourthExampleReferenceParameters.zip

Using static methods and attributes

fifthExampleStatic.zip

A recursive example (counting)

sixthExampleRecursionCounting.zip

Three versions of an example that sums a series (1 works, 2 others have intentional errors)

seventhExampleRecursionSum.zip

Two programs to illustrate the difference between tail and non-tail recursion

eighthExampleTailVsNonTail.zip