java.lang.String-firstMethod-charAt()

english prototype---

 

charAt

public char charAt(int index)
Returns the char value at the specified index. An index ranges from 0 to length() - 1. The first char value of the sequence is at index 0, the next at index 1, and so on, as for array indexing.

If the char value specified by the index is a surrogate, the surrogate value is returned.

 

Specified by:
charAt in interface CharSequence
Parameters:
index - the index of the char value.
Returns:
the char value at the specified index of this string. The first char value is at index 0.
Throws:
IndexOutOfBoundsException - if the index argument is negative or not less than the length of this string.

中文--

public char charAt(int index)charAt()  //一般我们看API的时候我们要关注这个方法名,返回类型,以及参数等几个方面,

        返回特定索引上的一个char值,索引的范围是:0-字符串长度减一,第一个char的下标索引值是0,下一个是1,和数组时相类似的,如果char的值被特殊的索引替代,则这个替代的值就会被返回去。

     charAt存在于接口CharSequence中,

     参数:

    索引-就是指的那个char的值

    抛个异常:

     跑出一个IndexOutOfBoundsException(数组下标越界),如果索引是一个负数或者小于这个字符串的长度,就会抛出这个异常。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值