Java toCharArray() メソッド
toCharArray() メソッドは文字列を文字配列に変換します。
構文
public char[] toCharArray()
パラメータ
无
戻り値
文字配列。
例
public class Test {
public static void main(String args[]) {
String Str = new String("www.example.com");
System.out.print("返回值 :" );
System.out.println( Str.toCharArray() );
}
}
上記のプログラムの実行結果は次のとおりです:
返回值 :www.example.com
その他の拡張
Java Stringクラス