aspose file tools*
The moose likes Beginning Java and the fly likes Convert char array into a string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Convert char array into a string" Watch "Convert char array into a string" New topic
Author

Convert char array into a string

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
How do I convert a
char[] password = new char[8];
into a Sting
String new_password.

return (String) password or new_password = (String)password
Rikard Qvarforth
Ranch Hand

Joined: Jul 10, 2001
Posts: 107
Hello
This is taken directly from the String class
String(char[] value)
Allocates a new String so that it represents the sequence of characters currently contained in the character array argument.
String(char[] value, int offset, int count)
Allocates a new String that contains characters from a subarray of the character array argument.
hope it helps !

------------------
Sun Certified Programmer for Java 2 Platform
Ahmer Arman
Greenhorn

Joined: Nov 23, 2001
Posts: 6
Hi,
You can use the method
toString(char[]);

------------------
Ahmer Arman


Ahmer Arman
Colin Kenworthy
Ranch Hand

Joined: Aug 06, 2001
Posts: 88
Download the Java API documentation - you'll find everything you need to know in there!
 
Don't get me started about those stupid light bulbs.
 
subject: Convert char array into a string