Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help! (one error)

 
federico elbl
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm new with Java, and I need help with a program that I wrote.
It needs to prompt the user for the x value, the y value, and the radius value, and then display the info in a JTextArea. Is giving me the following error:

I don't know what I'm doing wrong. I would really appreciate your help with this. This is the code i have:

Thanks a lot
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've got a close bracket labelled "end main", but you've actually not got the beginning of a main() method, or any methods. You've written all the code inside the scope of the class itself, and this isn't legal. Classes can contain member variable declarations, but they can't contain statements -- statements (like "x = Integer.parseInt(...)") have to be inside a method.
 
federico elbl
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. Now is giving me these three errors:

 
federico elbl
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. Now is giving me these three errors:

 
Carl Pettersson
Ranch Hand
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Since you end the statement where you add text to the string with a ; it doesn't understand what you are doing. Replace the ; which I have marked with a +. After that change you will probaly get an error that says you cant use the += operator on a string, so replace it with .= which means append.
 
federico elbl
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot carl! i made that work, but now the jtextarea is not working. is giving me this error:

/tmp/26198/CircleTest.java:48: cannot resolve symbol
symbol : method showMessageDialog (,javax.swing.JTextArea,int)
location: class javax.swing.JOptionPane
JOptionPane.showMessageDialog( null, output, JOptionPane.INFORMATION_MESSAGE );
^
1 error
and this is the code i have:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic