aspose file tools*
The moose likes Beginning Java and the fly likes Illegal start? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Illegal start?" Watch "Illegal start?" New topic
Author

Illegal start?

Martin vanPutten
Ranch Hand

Joined: Mar 26, 2006
Posts: 124
Why do I get an illegal start at public in getPrice()?



Live And Let Learn.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Because the closing brace of setPrice() is missing.

A good programmer's editor or IDE would point out this kind of problem very quickly. A simple editor that knows how to do Java code formatting would work well enough -- the missing brace would mess up the formatting.


[Jess in Action][AskingGoodQuestions]
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Usually you get errors like that when there are mismatched braces or other problems with punctuation in the lines before the line where you get the error.
Martin vanPutten
Ranch Hand

Joined: Mar 26, 2006
Posts: 124
I don't understand, doesn't it have a closing brace?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Look at setPrice(). The last character that clearly belongs to it is indeed a closing brace; but it's the closing brace of an "else" clause. There should be another one to end the whole method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Illegal start?