【问题标题】:Array Required But String Found error需要数组但找到字符串错误
【发布时间】:2016-05-08 19:54:02
【问题描述】:
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的数组大小的代码

【问题讨论】:

    标签: arrays string initialization


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-09
      • 2013-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-23
      • 1970-01-01
      相关资源
      最近更新 更多