This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Need help Getting error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help Getting error "illegal error:illegal start of expression"" Watch "Need help Getting error "illegal error:illegal start of expression"" New topic
Author

Need help Getting error "illegal error:illegal start of expression"

xiu vue
Greenhorn

Joined: Oct 28, 2009
Posts: 5
So I'm doing a lab for school and I keep getting illegal error: illegal start of expression. can someone please help me.
I posted the script below.


fbr - code tags added for readability
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18101
    
  39

xiu vue wrote:So I'm doing a lab for school and I keep getting illegal error: illegal start of expression. can someone please help me.


These types of errors are generally caused by a mismatch brace -- meaning you forgot to close an initializer, method, contructor, etc. And you are hence trying to declare a method inside another method, or something else that is not legal. Take the line number reported by the compiler and look around there, generally going backwards from that line is a good idea.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
xiu vue
Greenhorn

Joined: Oct 28, 2009
Posts: 5
Ok, Ill try that Thank You.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36453
    
  15
And welcome to JavaRanch

Please always tell us what the thread is about.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

And also use code tags.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10908
    
  12

once the code tags are added, it's pretty easy to find the problem. you declare your constructor on line 11, but never close it. Then comes the start of a new method...


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
 
subject: Need help Getting error "illegal error:illegal start of expression"
 
Similar Threads
Comments on my first program to use an object
help please
Having troubles with a complex program, need help with an illegal start of type error.
Help with Value Returning Methods
sorry ... i know you guys have seen this one many times ...