这是我写的示例代码,
public static void main(String []args){
String inputString = "apple";
char a = inputString[2]; //one
System.out.println(inputString[2]); //two
}
Run Code Online (Sandbox Code Playgroud)
一和二都给我一个错误,说Array type expected; found: 'java.lang.String'我做错了什么?如何访问字符串中的特定索引?