ArrayIndexOutOfBoundsException
Javaで文字列入力を取得すると、Javaが取得されました。私を助けてください。これは私のコードです: 私は自分のコードを編集して、次を使用して分割しました:
スレッド「メイン」の例外 java.lang.ArrayIndexOutOfBoundsException: solution2.Solution.main(Solution.java:27) で 1
public class Solution {
static String search;
public static void main(String[] args){
String[] fn,ln,tp;
boolean[] isSet;
Scanner sc=new Scanner(System.in);
int no=sc.nextInt();
String[][] temp=new String[no][3];
fn=new String[no];
ln=new String[no];
tp=new String[no];
isSet=new boolean[no];
boolean flag=false;
for(int i=0;i<no;i++){
temp[i]=sc.nextLine().split(":");
fn[i]=temp[i][0];
ln[i]=temp[i][1];
tp[i]=temp[i][2];
isSet[i]=true;
}
System.out.println(temp.length);
search=sc.nextLine();