恩蓝号

charat是什么类里的方法,character

charAt方法:

java.lang.String.charAt()方法 返回 指定索引 处的 char值。索引范围 是从0 到length() - 1。

public char charAt(int index) { if ((index < 0) || (index >= value.length)) { throw new StringIndexOutOfBoundsException(index); } return value[index]; }String s = "We are happy.";System.out.println(s.charAt(1));//e

免责声明:文章源自网络,版权归原作者所有,如有侵犯联系删除。

当前位置:首页 > 编程知识 » 2023-02-19 12:32:26

猜你喜欢


java定义方法,java调用方法

charAt() 方法可返回指定位置的字符。 请注意,JavaScript 并没有一种有别于字符串类型的字符数据类型,所以返回的字符是长度为...