charAt() 方法用于返回指定索引处的字符。索引范围为从 0 到 length() - 1。
public class Test {
public static void main(String args[]) {
String s = "abababc";
char result = s.charAt(6);
System.out.println(result);
}
}
结果输出:c
微信扫一扫
charAt() 方法用于返回指定索引处的字符。索引范围为从 0 到 length() - 1。
public class Test {
public static void main(String args[]) {
String s = "abababc";
char result = s.charAt(6);
System.out.println(result);
}
}
结果输出:c
相关推荐