next up previous
Next: What to hand in Up: Homework 1: Java compilation Previous: Edit the program

Make mistakes

It is a good idea to commit as many errors as you can think of with this program, so that you see what error messages the compiler produces. Sometimes the compiler will tell you exactly what is wrong, and all you have to do is fix it. Sometimes, though, the compiler will produce wildly misleading messages. You will develop a sense for when you can trust the compiler and when you have to figure things out yourself.

1.
Remove one of the open squiggly-braces.

2.
Remove one of the close squiggly-braces.

3.
Instead of main, write mian.

4.
Remove the word static.

5.
Remove the word public.

6.
Remove the word System.

7.
Replace println with pintln.

8.
Replace println with print.

9.
Delete one of the parentheses. Add an extra one.

How many of the syntax rules of Java can you guess just by the error messages from the compiler? If you are ever unsure whether something is legal in Java or not, ask the compiler!


next up previous
Next: What to hand in Up: Homework 1: Java compilation Previous: Edit the program
Allen B. Downey
1999-09-08