This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

netbeans 7.1 errors  RSS feed

 
Adrian Jakubas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to programming so any help would be appreciated

it says "illegal start of expression, identifier expected"
now I don't know if it is anactual Nerbeans problem or not buy here's my code:


 
Stephan van Hulst
Saloon Keeper
Posts: 7806
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Adrian, welcome to CodeRanch.

Your code starts with public static void main(String[] args) {

I don't think you intended that.
 
Campbell Ritchie
Marshal
Posts: 55698
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

"Illegal start ..." errors usually mean you have too many { or too few }.

If you are using an IDE like NetBeans, doesn't it insert whole pairs of {}? In which case you can put your mouse inside the pair {*} and put the contents of the method there.
 
Campbell Ritchie
Marshal
Posts: 55698
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adding code tags shows your code to be very badly indented, and, as Stephan has told you, the method heading before the import declarations. If you move that to inside the class, you can probably persuade NetBeans to format and indent your code correctly, and you can try again.
 
Campbell Ritchie
Marshal
Posts: 55698
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you copy the code by hand? There are other errors, eg JTectField instead of JTextField.
 
Adrian Jakubas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adrian Jakubas wrote:I'm new to programming so any help would be appreciated

it says "illegal start of expression, identifier expected"
now I don't know if it is anactual Nerbeans problem or not buy here's my code:


 
Campbell Ritchie
Marshal
Posts: 55698
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and??
We have already made useful suggestions.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!