Java toCharArray() 方法
toCharArray() 方法將字符串轉換為字符數組。
語法
public char[] toCharArray()
參數
無
返回值
字符數組。
實例
public class Test { public static void main(String args[]) { String Str = new String("www.w3big.com"); System.out.print("返回值 :" ); System.out.println( Str.toCharArray() ); } }
以上程序執行結果為:
返回值 :www.w3big.com