File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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
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

Joined: Nov 23, 2001
Posts: 6
You can use the method

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!
I agree. Here's the link:
subject: Convert char array into a string
It's not a secret anymore!