句法
- String getAt(int index)
参数
- Index - 要返回的字符串的位置
返回值
索引位置的字符串值
例子
下面是一个使用这个方法的例子 -
- class Example {
- static void main(String[] args) {
- String a = "Hello World";
- println(a.getAt(2));
- println(a.getAt(6));
- println(a.getAt(7));
- }
- }
当我们运行上面的程序,我们将得到以下结果 -
- l
- W
- O
转载本站内容时,请务必注明来自W3xue,违者必究。