Practical Coding in Java

Learn to write and validate your own code

Darren Kessner, PhD

(revised October 21, 2025)

Previous: Bounce

Coding Exercises: Processing Libraries

1. Hello, Processing!

Get the HelloProcessing.java program above to compile and run.

The focus of this exercise is to figure out how to set your CLASSPATH so that javac and java can find your Processing libraries.

2. Processing + classes

Write a program like Bounce above that involves an external class (e.g. Ball).

Objects require a member PApplet reference for drawing. The focus of this exercise is to understand how this works, including

  1. declaring a PApplet member variable in any external class

  2. passing a PApplet reference to the constructor to initialize the member variable

  3. using the PApplet reference to call PApplet drawing functions

3. Bonus: Bouncing Ball

Write your own Bouncing Ball program from scratch, using a class to represent a Ball.

Even better, use the PVector class for the position and velocity.