Java 教程 Java toCharArray() 方法

asa · 2022-05-27 00:00:46 · 热度: 74

toCharArray() 方法将字符串转换为字符数组。

语法

public char[] toCharArray()

参数

返回值

字符数组。

实例

public class Test {
    public static void main(String args[]) {
        String Str = new String("www.codercto.com");

        System.out.print("返回值 :" );
        System.out.println( Str.toCharArray() );
    }
}

以上程序执行结果为:

返回值 :www.codercto.com

查看更多 Java String 类 相关内容

猜你喜欢:
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册