Okay, your code compiles fine for me, so let's move on to your installation of Java 1.5. What do you get when you type "javac -version" at the command line? (Without a file name, you'll get a long error message, but it should start with the version.)
...javac -version
javac 1.5.0_06 javac: no source files...
My
guess is that you're on a Windows machine, and you didn't adjust your PATH variable properly. See Step 5 of these
installation instructions for Windows. BUT note that the system checks the PATH variable from left to right, looking for a path that will work. So if you have a path for a prior version of Java listed first, then it will use the prior version.