【发布时间】:2021-08-09 21:25:26
【问题描述】:
如果需要一定数量的输入,我将如何打印出用户输入?
import java.util.Scanner;
public class SilentAuction {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int amount = sc.nextInt();
for (int i = 1; i <= amount; i++) {
System.out.println();//need to write "int sm = sc.nextInt;" and "String s = sc.nextLine;"
}
}
}
【问题讨论】:
-
System.out.println(sc.nextInt());? -
专业提示:使用摘要标题而不是很长的标题,并将其余信息放在正文中
-
当你说,输入量。您是指用户输入的金额还是输入的字符/数字的数量?我看到班级名称是 SilentAuction。那么,您是否尝试将先前输入的金额与当前金额进行比较?还是您想找到最高金额的出价?