package itheima004;
import java.util.function.Supplier;
public class MaxDemo {
public static void main(String[] args) {
getInt(new Supplier<Integer>() {
@Override
public Integer get() {
int[] arr={34,56,12,11,0,98,102};
int max=arr[0];
for(int x:arr){
// if(arr[x]>max){
// max=arr[x];
// }
// System.out.println(arr[x]);
}
return max;
}
});
}
private static int getInt(Supplier<Integer> sup){
return sup.get();
}
}
为什么会报索引越界错误