Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Convert string to char array in Java

public class Demo {
   public static void main(String []args) {
      String str = "Tutorial";
      System.out.println("String: "+str);
      char[] ch = str.toCharArray();
      System.out.println("Character Array...");
      for (int i = 0; i < ch.length; i++) {
         System.out.print(ch[i]+" ");
      }
   }
}

OUTPUT:
String: Tutorial
Character Array...
T u t o r i a l
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #Convert #string #char #array #Java
ADD COMMENT
Topic
Name
9+7 =