Topic 1 - Variables and Data Types
Topic 2 - Conditionals and Strings
Topic 3 - Loops
Topic 4 - Arrays
Topic 5 - File Handling
Semester 1 Projects
Topic 6 - Classes/Objects and Methods
Topic 7 - ArrayLists
Semester Projects

FAQ

Take a look at these FAQs before you get started. We hope that this will encourage you to check these when you get stuck!

Q I run my program many times and after a while eclipse starts to get really slow.
A Click on the red square to stop each program individually.

Q I keep getting the following error: Uncaught error fetching image: java.lang.NullPointerException.
A This error message arises because some, or all, of the images are not in the same folder as the result of your code. Please place any additional images files in the same place!

Q I keep getting the following error: Exception in thread ”main” java.lang.OutOfMemoryError: Java heap space.
A This error message arises when you are trying to load too big a file. Given the current framework, the project works best with moderately-sized images.

Q I tried to compare two images together using the equals method in the Picture class, and even though they are obviously visually the same, the equals method returns false.
A Check to see whether one of the image files is a JPEG file. The equals method fails on JPEG files because JPEG files use lossy compression to store images: in other words, they compress an image to store it, but doing so causes information to be lost. Since the equals method attempts a perfect information match, it does not work well with JPEG files. This problem will not arise with GIF, BMP, and PNG files, since these file types involve lossless compression.

Q Any tips on these two-dimensional arrays?
A Here is a quick-summary reference on Java Arrays and here is Java’s official (longer) tutorial on arrays.

Q If there is a tie for a minimum path, which path should we pick?
A By default, please pick the cell above in a tie, if there is only a tie between the left and the right pixels, please pick the left pixel.

Q My energy is off by just a few pixels! What is wrong?
A Inside the energy() method you’ll be working with two different Picture objects. The object the method was called on (this) and the one you plan to return. When you call the method getEnergy(x, y) make sure you call it on this and not the Picture object you plan to return because the contents of the object this won’t be changing…

Q My showEdges() method does not pass the tests, even though my resultant picture and the test picture look exactly the same. What can I do?

A If you are using the Pixel.colorDistance() method, cast its result to an int before comparing it with the threshold.