首页 > 编程知识 正文

java中chararray,java charat方法

时间:2023-05-04 04:44:09 阅读:285918 作者:1371

charAt() 方法用于返回指定索引处的字符。索引范围为从 0 到 length() - 1。

语法 public char charAt(int index) 参数

index -- 字符的索引。

返回值

返回指定索引处的字符。

实例 public class Test {    public static void main(String args[]) {        String s = "www.runoob.com";        char result = s.charAt(8);        System.out.println(result);    }}

以上程序执行结果为:

o

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。