CS51 - Fall 2009 - Lecture 2

  • Lab 1:
  • Description: <html> <pdf>
  • Variables
  • variables as a way of labelling/naming something so that you can refer to it later
  • to use a variable you first declare it, and then assign a value to it. Assignment is done using "=" but this does not mean the same thing as "=" in math.
  • instance variables are variables that can be used in all methods, and in different calls to the same method. They are declared in a class but outside of all methods. For now, always private.
  • UpDown
  • Methods, Parameters
  • accessors (methods which return something, e.g. getX) and mutators (methods which do something, e.g. onMousePress or setColor)
  • actual parameters and formal parameters
  • ImprovedMakeBox
  • Combining instance variables and formal parameters
  • Spirograph
  • Scribble