2
如何正確使用charAt函數來檢索我的用戶想要輸入的字符串字符?我不斷收到關於我的(parseInt)函數的錯誤。CharAt函數
System.out.println("Choose an individual character to print out: ");
int number = 0;
try
{
number = Integer.parseInt(input.nextInt());
}
catch (IOException E)
{
System.out.println(E);
}
String aString = input.next();
char aChar = aString.charAt(number);
System.out.println ("The character you chose to print out is: " + aChar);
'aString.charAt(數)' – wero