Exceção de programação Java
Alguém pode me ajudar? Eu não entendo essa exceção:
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)
Aqui está o código responsável:
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));
}
}
}