import java.util.Scanner;
public class mainM {
public int[] insertData() {
int[] arr;
arr=new int[10];
int n=1;
for(n=1;n<=10;n++) {
System.out.println("请输入第"+n+"个数据");
Scanner sc=new Scanner(System.in);
arr[n-1]=sc.nextInt();
if(n==10) {
break;
}
}
return arr;
}
public void showData(int[]a,int length) {
mainMenth zy=new mainMenth();
int arr[] =zy.insertData();
System.out.println("数组的元素为:");
for(int i=0;i<10;i++) {
System.out.print(arr[i]+" ");
}
System.out.println();
}
public static void main(String[] args) {
mainM zy=new mainM();
zy.showData(int[]arr,int arr.length ); //这里怎么提示错误?
}
}
静谧星空1