This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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

Win a copy of Building Microservices this week in the Design forum!
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Convert char array into a string
It's not a secret anymore!