Intro to Object-Oriented Programming

BlueJ OO review demo


  • BlueJ Tutorial
  • Do BlueJ Interactive Tutorial
  • Review or re-do Interactive Tutorial


Here are Greenfoot Classes and method to pay particular attention to “starter cheatsheet”):

  • World: there is exactly one instance of World; it provides the “playing field” for the Actors. Methods we used:
    • World( width, height, cellsize ) initializes the World
    • removeObject( object ) erases a specific object from the World
  • Actor: everything else in your Greenfoot project is some kind of Actor; that is, classes you create that inherit from Actor. Methods we used:
    • act(): we must define this method for each Actor child class we define to tell the object what to do for each “tick” of the World “clock”.
    • move( step ) moves an Actor a given number of steps
    • turn( degrees ) changes the direction the Actor is pointing (and moving)
    • getWorld() gets the World object so we can tell it to do something
  • Greenfoot: this provides access to system items such as the keyboard, the mouse, etc. Method we used:
    • isKeyDown( key ) tells us whether a particular key is pressed
  • Simplified Greenfoot API /cheatsheet
  • Complete Greenfoot API

Greenfoot Resources

Greenfoot features to remember

  • Save the world
  • Right-click on World or Actor to run methods

BlueJ and Greenfoot editor features to remember

  • Color-coded nesting
  • Finding matching parenthesis, curly bracket, square bracket
  • Code completion: Ctrl-Space (limited compared to other editors)



Practice browsing and using the Java 8 API!

Turtle Exercise

  • Review Unit tests


The official Github Cheatsheet is the most helpful in my opinion.