永发信息网

编译时候Photo photos=photoList.get(n-1); 出现imcompatible types错误 不知道错在哪

答案:1  悬赏:30  手机版
解决时间 2021-03-24 01:23
  • 提问者网友:末路
  • 2021-03-23 08:09
编译时候Photo photos=photoList.get(n-1); 出现imcompatible types错误 不知道错在哪
最佳答案
  • 五星知识达人网友:患得患失的劫
  • 2021-03-23 08:16
public Photo findPhoto(int subjectIndex){
String subjectText=captions[subjectIndex-1];
int count1=0;
int count2=0;
ArrayList photoList = new ArrayList(10);
for(int i=0;i Photo photo=photoArray[i];
String text=photo.getSubject();
if (text.equals(subjectText))
count1 += 1;
photoList.add(photo);
}
int n = rd.nextInt(count1)+1;
Photo photos=photoList.get(n-1);
return photos;
}

或者

Photo photos=(Photo)photoList.get(n-1);
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯