It's actually a runtime exception (not error) because the program tries to access an uninitialized array element. (You're also missing an opening brace at main().)
Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4 all those years ago...)