줄마다 텍스트 파일 줄을 스캔하는 프로젝트에서 작업 중이며 줄의 각 단어는 배열텍스트 파일의 한 줄로 배열에 단어 당 단어 저장
에 저장됩니다여기 내 코드입니다. Answer.txt 파일에서 저장할 때 오류가 발생합니다. 누군가 나를 도울 수 있습니까?
try
{
String s = sc.nextLine();
//System.out.println(s);
String[] Question = s.split(" ");
for(int i=0;i<=Question.length;i++)
{
System.out.println(Question[i]);
}//debug
s = sc2.nextLine();
//System.out.println(s2);
String[] Answer = s.split(" ");
for(int c=0;c<=Answer.length;c++)
{
System.out.println(Answer[c]);
}//debug
}
catch (ArrayIndexOutOfBoundsException e)
{
System.out.println("...");
}
어떤 오류가 발생합니까? –