ICS 22 / CSE 22 Fall 2012
Code Examples


Code examples, from lecture and otherwise

Over the course of the quarter, I'll be providing commented code examples for you. You are not permitted to copy and paste any of this code into your own projects. These examples are mostly to give you clean and well-documented examples of some of the things we cover in lecture (and possibly a few things that we don't, time permitting), so that you can be free in lecture to avoid trying to take detailed notes when we're writing code together, instead concentrating on understanding the process and the bigger-picture concepts at work.

Lecture Date(s) Description
Tu 10/2 The DayOfWeek example of enumerations in Java
Th 10/4 Reading from files and exception handling in Java
Th 10/11
Tu 10/16
Test-driven development and writing unit tests using JUnit
Tu 10/16 An example of writing an equals() method to compare for equivalence instead of identity
Th 10/18
Tu 10/23
The Weapon hierarchy, an example of inheritance and polymorphism
Th 11/15 Interfaces, comparability, and natural ordering