The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
October 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Character to String...

Posted by Mukul on October 29, 2001 at 10:11 PM

> ok java nuts, i have 3 variables all of the type char...
> i need to append them all together to form a string, how would i go about doing so?
> i thought String result = operand2 + operator + operand1; would work by concatenating them together, but no...any ideas???


2 ways...

if c is the character...

1. Use String.valueOf(c), This gives a String representation of the argument i.e. c

2. Add to StringBuffer and finally get a String by calling toString() on the StringBuffer



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us