码迷,mamicode.com
首页 > 编程语言 > 详细

Java charAt() 方法

时间:2018-11-15 22:26:17      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:str   索引   返回   .com   static   index   print   指定   oid   

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

参数

  • index -- 字符的索引。

返回值

返回指定索引处的字符。

实例

public class Test {

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

  

Java charAt() 方法

标签:str   索引   返回   .com   static   index   print   指定   oid   

原文地址:https://www.cnblogs.com/max-hou/p/9965992.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!