Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

illegal start of expression??

 
Fazz
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic