• Post Reply Bookmark Topic Watch Topic
  • New Topic

problems the program

 
Lois Smith
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having problems with this program. When I run javac I am getting e errors about illegal start of expression.



Error is at
public void setResultValue(); What do I need to do to fix this error?
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the semi-colon:
 
Lois Smith
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did as you suggested but still having issues. Here is the latest version with 4 errors.


errors are:
line 57 else without if??? else if (event.getsource()= JButton ("Clear')
line 74 3 errors 2 illegal start of expression and one ; expected

I did not think you needed a ; for public void *.*
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would help if you indicated which lines are 57 and 74.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to be honest with you, the types of errors indicate this is your first program,
or an assignment in debugging, so us just fixing it for you is not going to help you at all.

if this is your first program, you shouldn't be trying to build a gui, instead
just start with the tutorials and the HelloWorld app and learn the basics before
attempting a gui program.

if a debugging app, start with the first error from the compiler, read what it says,
and fix that error then recompile. Only (and only) fix one error at a time.
 
Lois Smith
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read the tutorials and am trying to learn now to write a GUI. after the errors listed I have put the code that it is referencing. I was just looking for how to fix these errors.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lois Smith:
I have read the tutorials and am trying to learn now to write a GUI. after the errors listed I have put the code that it is referencing. I was just looking for how to fix these errors.


Your code has too many errors to easily fix, and I'd recommend that you simply scrap it. I agree with the other poster that you should go through the Sun Swing tutorials (again if need be), but slowly and one step at a time, going through all the example programs. It will make it a whole lot easier and enjoyable for you when you are ready to fly on your own with this type of project.

Much luck.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another tip is to write the smallest possible amount of code that will compile at a time, then compile it, then test it, if possible. Then add a few more lines, and compile and test again. If you write a few hundred lines and then try to compile it, it's hard to know where you've gone wrong. But if you've written five lines, then, well, it's one of those five!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!