Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes illegal start of expression?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "illegal start of expression??" Watch "illegal start of expression??" New topic

illegal start of expression??


Joined: Mar 16, 2006
Posts: 9
When attempting to compile the following code, i recieved the message, 'illegal start of expression', with the line in bold, highlighted. Any ideas what that would mean???

private void go() {
String test = "Mary had a little lamb";
for(StringTokenizer token = new StringTokeizer(test); token.hasMoreTokens() {
String word = token.nextToken();
System.out.println("Word = " + word);
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24193


Welcome to JavaRanch!

It generally means that there's a real error on a line before this. The most likely problem is a missing close-brace, so that this method declaration seems to appear inside the preceding method.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: illegal start of expression??
jQuery in Action, 3rd edition