您好,欢迎来到外链网!
当前位置:外链网 » 站长资讯 » 专业问答 » 文章详细 订阅RssFeed

charat是什么类里的方法,character

来源:互联网 浏览:83次 时间:2023-04-08
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