字符串str中索引位置是6的字符
2023-05-27 本文已影响0人
哈迪斯Java
public class Ref { // 创建类
public static void main(String args[]) { // 主方法
String str = "hello world"; // 定义字符串str
char mychar = str.charAt(6); // 将字符串str中索引位置是6的字符返回
System.out.println("字符串str中索引位置是6的字符为:" + mychar); // 输出信息
}
}