Forums Register Login

Displaying 3 char in JOptionPane

+Pie Number of slices to send: Send
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 ()
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

pete stein wrote:a StringBuffer


StringBuilder is better unless you need the synchronization. In most cases you don't.
+Pie Number of slices to send: Send
oooh, you want to combine those 3 chars eh?

well create a single String, and then put those 3 char inside of it.
Done!
+Pie Number of slices to send: Send
 

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!
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1785 times.
Similar Threads
Fun with stacks
random.nextInt + If statements
putting a name in an array
How to ignore or remove comments from a java file with the help of another java file.
Add & Delete Table rows dynamically
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:13:53.