import?java.util.Arrays;
import?java.util.Random;
public?class?MinArray?{
????public?static?void?main(String[]?args)?{
????????int?arr[]?=new?int[10];
????????Random?ran?=new?Random();
????????for(int?i=0;i<arr.length;i++)
????????{
????????????arr[i]=ran.nextInt(100);
????????}
????????System.out.println("數(shù)組數(shù)據(jù)為:"+?Arrays.toString(arr));
????????int?min=arr[0];
????????for(int?i=0;i<?arr.length;i++)
????????{
????????????if(min>arr[i])
????????????{
????????????????min=arr[i];
????????????}
????????}
????????System.out.println("min:"+min);
????????arr?=?new?Arrays.copyOf(arr,arr.length+1);//這里copyOf報紅?。
????????arr[arr.length+1]=min;
????????System.out.println("數(shù)組中的數(shù)據(jù)為:"+Arrays.toString(arr));
????}
}
這是報的錯誤 java: 找不到符號 符號: 類 copyOf 位置: 類 java.util.Arrays
qq_慕俠6290277
2020-09-26 10:42:11