• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error in Code

 
Greenhorn
Posts: 27
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Getting below mentioned error when I copied the below code and pasted in eclipse.

"Syntax error on tokens,deete these tokens"

I do not see any problem in the code.


but I am not getting any error when I type the code in eclipse.

PS: I copied the code (inside code tags) from here (in Preview mode) and pasted in Eclipse, I don't see any error now.

Can anyone tell me what was the problem I was facing.

I have attached the screenshot of error.


Screenshot-(195).png
[Thumbnail for Screenshot-(195).png]
Screenshot shows error
 
Marshal
Posts: 8856
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe syntax error on line 3, which is hidden with tooltip in your provided image. However, move onto the next chapters, don't waste time, this code is fine.

And use combination of next 3 keystrokes to format and indent the code. Windows keyboard ctrl + shift + f macbook keyboard cmd + shift + f.
 
Ranch Hand
Posts: 145
4
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Clean Project in eclipse when you face such kind of errors
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately a tooltip is covering a part of the code, so it's very hard to tell what's wrong. The code in your first post is perfectly fine and will compile successfully.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Narayana Bojja wrote:Clean Project in eclipse when you face such kind of errors


Using command line javac (and java) is even better
 
Indu Acharya
Greenhorn
Posts: 27
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the code without tooltip. I wanted to show the error that covered the line 3.


Liutauras - I wanted to know what was wrong so that it would be helpful in future when I face same error.
Screenshot-(196).png
[Thumbnail for Screenshot-(196).png]
 
Liutauras Vilda
Marshal
Posts: 8856
637
Mac OS X VI Editor BSD Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Indu Acharya wrote:Liutauras - I wanted to know what was wrong so that it would be helpful in future when I face same error.

In the future you most likely will know what to do (there is nothing wrong with code, at least I don't see it now). Problems probably could be solved by rebuilding or update'ing project (by clicking right mouse button on the specific project you'd find such option.

In the meantime, since you're getting ready for the certification, Roel gave you a very valid advice - use command line compiler. This is what mots of the certification preparation books advice, don't they? Eclipse highlighting you errors, while nobody during the exam will do that - so better train your eyes using simple text editor with no help and command line compiler, which can be invoked from the console:
 
reply
    Bookmark Topic Watch Topic
  • New Topic