• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Syntax Error

 
Greenhorn
Posts: 2
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
author & internet detective
Posts: 41502
881
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code is not in a single file, is it ?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 77291
371
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic