Answers for "how to take array elements as input using scanner class in java"

4

input array through scanner in java

public static void main (String[] args)
{
    Scanner input = new Scanner(System.in);
    double[] numbers = new double[5];

    for (int i = 0; i < numbers.length; i++)
    {
        System.out.println("Please enter number");
        numbers[i] = input.nextDouble();
    }
}
Posted by: Guest on January-12-2021

Code answers related to "how to take array elements as input using scanner class in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language