Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

netbeans 7.1 errors

 
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
Bartender
Pie
Posts: 5813
61
  • 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
Sheriff
Pie
Posts: 48968
60
  • 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
Sheriff
Pie
Posts: 48968
60
  • 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
Sheriff
Pie
Posts: 48968
60
  • 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
Sheriff
Pie
Posts: 48968
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and??
We have already made useful suggestions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic