简体   繁体   中英

Array Required But String Found error

for(int x=0;x<n;x++){
BT[x]=0;
WT[x]=0;
JB[x]=0; 
s1[x]=" ";
s2[x]=" ";
}  

I cannot initialize the string s1 and s2 it gives me error Array Required But String Found error.

int n,BT[],WT[],JB[];
String s1[];
String s2[];
String s=JOptionPane.showInputDialog("Enter no of process");
//System.out.println("Enter no of process");
n=Integer.parseInt(s);//sc.nextInt();
BT=new int[n+1];
WT=new int[n+1];
JB=new int[n+1];
s1=new String[n+1];
s2=new String[n+1];

This is the code that sets the array size of s1 and s2

Fixed it! the strings were not passed to the class below. dumb mistake

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM