• 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

JOptionPane problems

 
Gunslinger
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

If mySB is a stringbuffer, what is wrong with the following declaration? Error messages are:
C:\Documents and Settings\Owner.Mynotebook\Ch5ItIs\src\ch5itis\Chapter7Strings.java:29: <identifier> expected
JOptionPane.showMessageDialog(null, "The user ID is " + mySB);
C:\Documents and Settings\Owner.Mynotebook\Ch5ItIs\src\ch5itis\Chapter7Strings.java:29: illegal start of type
JOptionPane.showMessageDialog(null, "The user ID is " + mySB);
2 errors

 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Patrick Brooks:
...what is wrong with the following declaration? ...


It's not a declaration -- it's a method call. Nothing is wrong that that line of code, but it needs to be inside the body of a method.
 
James Brooks
Gunslinger
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It was inside valid code, but when I closed NetBeans and reopened, it compiled and ran just fine. Strange.


-Patrick
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic