我有一个数组,它是一个固定数组。我在创建它时为其分配了一些字符串,例如:
String []alpha = new String[]{"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q"};
但它给了我这一行的错误:
alpha.charAt(0); //error
我还尝试使用动态数组进行此操作,其中用户正在输入字符串,并使用 userText 变量访问字符串:
userText.charAt(i); //valid
这个对吗?我没有收到错误。