Scanner xxx = new Scanner(System.in);
然后xxx对象调用下列方法(函数),读取用户在命令行输入的各种数据类型:
next.Byte(),nextDouble(),nextFloat,nextInt(),nextLine(),nextLong(),nextShot()
package p3; import java.util.*; public class p3 { public static void main(String args[]){ Scanner a=new Scanner(System.in); int b[]; b = new int[5]; for(int i=0;i<5;i++){ b[i] = a.nextInt(); } int l=5; while(l!=0){ --l; System.out.printf("%d",b[l]); } } }
时间: 2024-10-11 13:25:14