我想要输入10组数据 存进数组中,然后遍历初来
import java.util.Scanner;
class Demo4
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
int []a=new int[10];
for (int x=0 ;x<10 ;x++){
int d = scanner.nextInt();
a[x]=d;
}
for (int x = 0;x<10 ;x++ ){
System.out.println(a[x]);
System.out.println(a.length);
}
System.out.println("Hello World!");
}
} |
|