Answers for "how to store string in char array"

1

java put a char array into a string

char[] arr = { 'p'," ",'q', 'r', 's' };
      String str = String.valueOf(arr);
      System.out.println(str);//"p qrs"
Posted by: Guest on March-20-2020
0

char array to string in java

// Method 1: Using String object
      char[] ch = {'g', 'o', 'o', 'd', ' ', 'm', 'o', 'r', 'n', 'i', 'n', 'g'};
      String str = new String(ch);
      System.out.println(str);
Posted by: Guest on June-02-2021
0

String to Char array

String s="abcd";
char[] a=s.toCharArray();

for(char c:a)
{ 	System.out.println(c); } 
Posted by: Guest on August-23-2021

Code answers related to "how to store string in char array"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language