charAt(int index)遍历一个字符串的所有字符实例
String name = "Whatisjava?";
for (int i = 0; i < name.length(); i++) {
char c = name.charAt(i);
System.out.print(c + " ");
}// W h a t i s j a v a ?
时间: 2024-10-11 10:26:34
charAt(int index)遍历一个字符串的所有字符实例
String name = "Whatisjava?";
for (int i = 0; i < name.length(); i++) {
char c = name.charAt(i);
System.out.print(c + " ");
}// W h a t i s j a v a ?