• Post Reply Bookmark Topic Watch Topic
  • New Topic

For loop syntax error  RSS feed

 
Chuck Barnes
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im trying to use this code from here. the post from [)ia6l0 iii

code snipet




I am getting a 'illegal start of expression' error on the system.out line.

I tried copy/paste but there is something wrong.

Sorry im new to java, can someone help?

Thanks
Chuck
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You look like you've got too many semi-colons on that line. Have a closer look.
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

isn't valid Java syntax.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using enumerations rather than an Iterator?
 
Chuck Barnes
Ranch Hand
Posts: 37
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I still get errors with that.

but this fixed it



As far as using an iterator, this is someone else code. I just want it to work first. I'll go back and make revisions later.
I guess proof of concept code not production code.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Why are you using enumerations rather than an Iterator?

Because some code still uses Enumeration, even in the core API. TreeNode.children() and ZipFile.entries() immediately come to mind.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shall we give him the benefit of the doubt and assume he has some legacy code to play with?
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Considering he's probably using javax.naming.NamingEnumeration and javax.naming.directory.Attribute, which have been available since Java 1.3, definitely.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!