簡體   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