charAt() 方法用于返回指定索引处的字符。索引范围为从 0 到 length() - 1。
public char charAt(int index)
index -- 字符的索引。
返回指定索引处的字符。
public class Test {
public static void main(String args[]) {
String s = "www.jb51.net";
char result = s.charAt(7);
System.out.println(result);
}
}
以上程序执行结果为:
在线实例
字符集 & 工具
最新更新
站点信息
Java String类