This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

"identifier expected after this token"  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this error after watching exactly someone was doing on YT in a tutorial. His worked but mine didn't...

Heres my code


Please help!
I've only been at Java for a few hours, and I really want to press on! :P

 
Sheriff
Posts: 21459
96
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

I've added code tags and some better indentation to your post. Especially that better indentation should show you that statement is not where you want it to be - inside the logoTimer anonymous class definition.
 
Daniel Tonks
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah! Thank you!

I was doing this in eclipse and the indenting seems a little glitchy for me. I see my error now. Thanks
 
Rob Spoor
Sheriff
Posts: 21459
96
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Spoor wrote:Welcome to the Ranch!

I've added code tags and some better indentation to your post. Especially that better indentation should show you that statement is not where you want it to be - inside the logoTimer anonymous class definition.



Im having the same problem can you post the updated code?
 
Bartender
Posts: 3320
86
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Why don't you post your code and we will help you find the problem.
 
Jeff Mezzanotte
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tony Docherty wrote:Welcome to the Ranch.

Why don't you post your code and we will help you find the problem.



 
Tony Docherty
Bartender
Posts: 3320
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To fix the code do as Rob suggested to the original poster.

If it's not immediately obvious, then starting at the line where you create a new Thread object, count +1 for each opening brace and -1 for each closing brace. When you are back to 0 you have finished the local class definition and after the final closing brace is where the errant line goes. If your count goes to -1 rather than going positive then you are starting the block with a closing brace instead of an opening brace.
 
Jeff Mezzanotte
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tony Docherty wrote:To fix the code do as Rob suggested to the original poster.

If it's not immediately obvious, then starting at the line where you create a new Thread object, count +1 for each opening brace and -1 for each closing brace. When you are back to 0 you have finished the local class definition and after the final closing brace is where the errant line goes. If your count goes to -1 rather than going positive then you are starting the block with a closing brace instead of an opening brace.



looks like it was the brace on line 18 thanks
 
Marshal
Posts: 60127
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is deceptively easy to suffer that sort of error, if you write your code forwards. Set up automatic indentation on your text editor and life will be a lot easier. Then you need to learn to write code backwards (at least in part). Writing backwards makes it much easier to ensure you have matched {}, and correct indentation allows you always to see how many {} you have got.
 
Ranch Hand
Posts: 499
AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff and Daniel,

Try removing the semicolon after the closing braces which is present before logoTimer.start();, the place where you get your error

And can you tell me why have you used }; after the error line?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!