繁体   English   中英

需要数组但找到字符串错误

[英]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]=" ";
}  

我无法初始化字符串s1和s2,这给了我错误Array Required but String Found错误。

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];

这是设置s1和s2的数组大小的代码

修复! 字符串没有传递给下面的类。 愚蠢的错误

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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