putting scanner into an array

56

putting scanner into an array -

public static void main (String[] args)
{
    Scanner input = new Scanner(System.in);//create an object type Scanner which called "input"
    double[] numbers = new double[5];//creating an array type double

    for (int i = 0; i < numbers.length; i++)
    {
        System.out.println("Please enter number");
        numbers[i] = input.nextDouble();
    }
}

Comments

Submit
0 Comments