aspose file tools
The moose likes Beginning Java and the fly likes Displaying 3 char in JOptionPane Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Displaying 3 char in JOptionPane" Watch "Displaying 3 char in JOptionPane" New topic
Author

Displaying 3 char in JOptionPane

Ken Mullins
Greenhorn

Joined: Sep 25, 2010
Posts: 25
Can someone tell me how I can get this to display in JptionPane ? It will display the first char but nothing else no matter what I put in the ()
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
a char will hold only a char. You'll need something that holds multiple chars, such as a... String. And if you're concatenating chars into a String a StringBuffer is a convenient and efficient way to do this.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

pete stein wrote:a StringBuffer

StringBuilder is better unless you need the synchronization. In most cases you don't.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
J. Insi
Ranch Hand

Joined: Aug 11, 2010
Posts: 83
oooh, you want to combine those 3 chars eh?

well create a single String, and then put those 3 char inside of it.
Done!
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Rob Prime wrote:
pete stein wrote:a StringBuffer

StringBuilder is better unless you need the synchronization. In most cases you don't.


Indeed! Thanks for the correction!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Displaying 3 char in JOptionPane
 
Similar Threads
putting a name in an array
Add & Delete Table rows dynamically
How to ignore or remove comments from a java file with the help of another java file.
random.nextInt + If statements
Fun with stacks