getAt()
语法 (Syntax)
String getAt(int index)
参数 (Parameters)
- Index - 要返回的字符串的位置
返回值 (Return Value)
索引位置的字符串值
例子 (Example)
以下是此方法的使用示例 -
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