This program is from the K&B SCJP book (exam version 1.5). I understand the program but it doesn't compile. The complete program and error are listed below:
However, one thing that could cause that error is if you have a clash in name between a core system class and one of your own. I just tried it, and I get exactly that error if I add my own CharSequence class to the same package. Is there any chance you've done that?
If so, you could get it to work properly by using the fully qualified name. But a better solution is to avoid doing that in the first place.