*
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
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: 19070
    
  40

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: 40052
    
  28
And welcome to JavaRanch

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

Joined: Oct 27, 2005
Posts: 19785
    
  20

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: 11499
    
  16

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Need help Getting error "illegal error:illegal start of expression"