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