Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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();
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #putting #scanner #array
ADD COMMENT
Topic
Name
1+6 =