Answers for "to char array"

27

java string to char array

String str = "example";
char[] ch = str.toCharArray();
Posted by: Guest on March-05-2020
0

change string to char array

String myString = "Hello, world!";
char[] myCharArray = myString.toCharArray();
Posted by: Guest on May-13-2021
0

converting char array to string

// Convert char array to String in Java
class Util
{
    public static void main(String[] args)
    {
        char[] chars = {'T', 'e', 'c', 'h', 'i', 'e', ' ', 
                        'D', 'e', 'l', 'i', 'g', 'h', 't'};
 
        String string = new String(chars);
        System.out.println(string);
    }
}
Posted by: Guest on February-26-2020
0

how to covert array into a char

String s="Welcome to Java Programming";
char arr[]=s.toCharArray();
for(int i=0;i<arr.length;i++){
    System.out.println("Data at ["+i+"]="+arr[i]);
}
Posted by: Guest on January-27-2021
0

char array to string

char arr[ ] = "This is a test";

string str(arr);


//  You can also assign directly to a string.
str = "This is another string";

// or
str = arr;
Posted by: Guest on June-26-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language