Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Syntax Error

 
Ron Buzan
Greenhorn
Posts: 2
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hate to be the noob. I thought I had worked the kinks out of this code, but the last remaining error is right at Line 1 with: "Syntax error on token(s), misplaced constructor(s)." I can attach the account class if needed.

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron Buzan wrote: I can attach the account class if needed.

Please do. I think the error is in there.
 
Ron Buzan
Greenhorn
Posts: 2
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what I was afraid of. Note - there are one or two elements in here I haven't tied in yet (DecimalFormat..), they're just hanging out til I get the thing to compile.

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code is not in a single file, is it ?
 
Niranjan Aithal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check your java version. There is nothing wrong with the code you have pasted. Autoboxing feature offered from Tiger (1.5) release of Java SDK.
try this :
Account account = new Account(1122, 20000d);

As Christophe pointed, if this is a single file put the import statement at the beginning :
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Niranjan, this has nothing to do with Java5 autoboxing feature. An int is casted into a double in previous versions too.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49411
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using DecimalFormat rather than the % tags?
 
Niranjan Aithal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:Niranjan, this has nothing to do with Java5 autoboxing feature. An int is casted into a double in previous versions too.

Thanks Christophe.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic