Convert String to Character Array - Java Language Basics

Java examples for Language Basics:String

Description

Convert String to Character Array

Demo Code

 
public class Main {
 
  public static void main(String args[]){
    String strOrig = "Hello World";
    char[] stringArray;
    stringArray = strOrig.toCharArray();
    for(int index=0; index < stringArray.length; index++)
      System.out.print(stringArray[index]);
  }/*  ww w.  ja v  a  2 s  .co m*/
}

Result


Related Tutorials