【24考研】数学全程班\/--》ccys1473
接收数据
int n = input.nextInt();
1
注:
整型:input.nextInt();
单精度浮点型:input.nextFloat();
双精度浮点型:input.nextDouble();
字符串类型:input.nextLine();//这种写法可以得到带空格的字符串
input.next();//此写法在读取内容时会过滤掉有效字符前面的无效字符,所以这种写法不能得到带空格的字符串
短整型:input.nextShort();
字节型:input.nextByte();
字符型:input.next().charAt(i);//i是指从用户输入的字符串中选取第i个单个字符输入到内存中,i从0开始