我对如何使用来自用户的输入来实例化数组感到困惑,我相信它应该在这里的注释旁边 import java.util.Scanner;
public class Sales
{
public static void main(String[] args)
{
int[] sales;
sales = getSales();
printSales(sales);
printSummary(sales);
}
private static int[] getSales()
{
Scanner input = new Scanner(System.in);
int[] temp;
System.out.print("Enter the number of salespeople: ");
temp = _____________; // RIGHT HERE
答案 0 :(得分:2)
你应该写一些类似的东西:
temp = new int[input.nextInt()];