我希望将以下字符串存储到一个数组中,但它会引发 ArrayOutOfBound 异常。
public static void main(String[] args) {
// TODO Auto-generated method stub
char[] arr = {};
String str = "Hello My Name is Ivkaran";
for (int i = 0;i < str.length(); i++){
System.out.println(str.charAt(i));
arr[i] = str.charAt(i);
}
}