public class FirstDemo {
/**
    *API中String的常用方法
    */

// 将字符串转换为字符数组----toCharArray();
public static void main(String[] args) {
    String str1 = "hello";
     char c[] = str1.toCharArray();
    System.out.println( "转换结果为:");
     for ( int i = 0; i < c.length; i++) {
     System.out.print(c[i] + "\t");
    }
    String str2 = new String(c); // 将字符数组转换为字符串
    String str3 = new String(c, 0, 3); // 获取部分字符串数组内容
    System.out.println( "--------------------------------");
    System.out.print( "获得全部字符数组内容    " + str2);
    System.out.println( "\n获得部分字符数组内容    " + str3);
    System.out.print( "从字符串中取出指定的字符    " + str1.charAt(1)); //取出字符串中第二个字符
}
}