We did an in-class code demo in this class. See the lecture code repository for this section for the completed example.

Today's example showed,

  • how to instatiate a class to create an object,
  • new chapter1.Terrarium()
  • how to call a method on a newly created object, and
  • new chapter1.Terrarium().add(new chapter1.Ant())
  • the instantiation relationship in a UML class diagram.