62,614
社区成员
发帖
与我相关
我的任务
分享
int b[]={};
for(int e:b){
e=in.nextInt();
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int[] array = new int[1024];
Scanner sc = new Scanner(System.in);
int i = 0;
while(sc.hasNext()){
array[i++] = sc.nextInt();
System.out.println("您输入的数字是:" + array[i-1]);
}
}
}
Scanner s = new Scanner(System.in);
int a = 0,i=0;
int[] result = new int[100];
System.out.println("请输入数字");
while ((a = s.nextInt()) != -1) {
result[i++] = a;
}
for (int j = 0; j < result.length; j++) {
System.out.println(result[j]);
}