The type of the expression must be an array type but it resolved to ArrayList (trying to compare string in two arrays

后端 未结 7 1261
刺人心
刺人心 2021-01-11 18:39

Iam trying to compare each string or int in array with another array then print the results according to whether the string exists or not in the other array: Below is the wh

7条回答
  •  佛祖请我去吃肉
    2021-01-11 19:25

    You can't get ArrayList objects by using [] operator like arrays.Use get() method on ArrayList to get the objects. So change the code

     if (Stocks[i].equals(NameofFileinDir[j])) > 0) {  
    

    to

      if (Stocks[i].equals(NameofFileinDir.get([j]))) > 0) {
    

提交回复
热议问题