cs230 Lecture Notes Week 9 Tuesday Implementation diagrams and the really big picture. Class and instance variables ---------------------------- instance variable: every instance has one. You can refer to them from object methods or, anywhere, using dot notation class variable: there's only one. You can refer to it from any method in the class, or from outside the class using dot notation Don't let the compiler lead you by the nose! Iterators --------- We often want to allow client code to traverse a data structure without completely breaking down the wiggly line of abstraction. Section 10.9 explains one way of accomplishing that: 1) the data structure provides a method that returns an Iterator object 2) Iterator is an abstract class defined in java.util 3) the methods of Iterator are hasNext and next Another example: there is a LinkedList class in java.util that has a method named listIterator that returns an object with type ListIterator which is a member of the abstract class Iterator which you can use to traverse the LinkedList! Trees -- Chapter 10 ----- tree node = cargo + 2 references FAT applies to tree nodes, too In this case, probably no sentinel class. Just tree nodes, which will be objects with type Tree. Vocabulary: node, root, leaf, child, parent, level Read all of Chapter 10 before Thursday so you can get started on the next assignment during lab.