• 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

JOptionPane problems  RSS feed

 
Gunslinger
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • 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
Java Mac Safari
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!