任何人都可以帮助我吗?我不明白这个例外:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 9
at java.lang.String.charAt(Unknown Source)
at charPerLine.main(charPerLine.java:13)
这是代码
import java.util.*;
public class charPerLine {
public static void main(String[] args)throws StringIndexOutOfBoundsException {
Scanner sc=new Scanner(System.in);
System.out.print("Type any name:");
String s=sc.next();
int j= s.length()+1;
for(int i=0;i<=j;i++){
System.out.println(s.charAt(i));
}
}
}