• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need help! (one error)

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic