Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with Errors

 
Mike Meakin
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me why I have got these errors:

"Applet2.java": Error #: 204 : illegal start of expression at line 92, column 70
"Applet2.java": Error #: 206 : malformed expression at line 92, column 15

Heres the code:

 
Steve Morrow
Ranch Hand
Posts: 657
Clojure Spring VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which one is line 92?

Also, it will help you to follow this: Code Conventions for the Java� Programming Language
 
Jon Egan
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have a decent editor with me at the moment, so I can't identify which line is 92 without a lot of manual manipulation of the code after copying and pasting it.... but here are some things I've spotted:

- there are some strange comments going on above the constructor and the init() method - comments start with // for a comment that extends to the end-of-line, or with /* for a comment that extends to the next */ You seem to be mixing these styles, although my best guess is that the way you've done it is working, and is not the problem

- you have a call to "enabeEvents", that is probably supposed to be "enableEvents" - again, not going to be the source of your compiler errors.... yet - this would come up after it was able to successfully parse your code, so you have to get past the existing problem

- you have some "stray" semicolons in the frame.setLocation() method call - and there's also a problem with the parentheses in this method call.

good luck.

-- Jon
 
Jon Egan
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,

I absolutely agree with Steve's suggestion that you learn and try to adopt Sun's coding style standards - most Java developers stick to it to some degree or another, which means:

- once you're used to it, you'll be better able to read the code of all those "conforming" programmers out there

- the vast majority of other Java programmers will be more able to help you with, and later maintain, your code - without having to run your code through a source code beautifier first

-- Jon
 
Timmy Marks
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a ; too many in the line about 6 lines from the bottom:


frame.setLocation((d.width - frame.getSize().width)); / 2, (d.height - frame.getSize() .height) /2);
 
Mike Meakin
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is line 92/93:
frame.setLocation((d.width - frame.getSize().width)); / 2,
(d.height - frame.getSize() .height) /2));

Removing a ; does not solve the problem.
[ May 11, 2005: Message edited by: Michael Munro ]
 
Steve Morrow
Ranch Hand
Posts: 657
Clojure Spring VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Removing a ; does not solve the problem.
I would imagine not. It looks like you're trying to comment out the last half of that statement (after the first semicolon), but you've only got one slash. Comments need two slashes.Once you have that semicolon, the compiler expects you to have reached the end of the statement and thinks the single slash is the start of your next statement (which, of course, causes it to unceremoniously barf).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic