• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

need help! (one error)  RSS feed

 
Greenhorn
Posts: 13
  • 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
 
author and iconoclast
Sheriff
Posts: 24220
40
Chrome Eclipse IDE Mac OS X
  • 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
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. Now is giving me these three errors:

 
Ranch Hand
Posts: 73
  • 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
  • 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:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!