Java Scanner nextDouble() Method

The NextDouble-Method in Java

Sometimes, we might require to get the double type data from the user (decimal numbers in short). In such situations, we can make use of the nextDouble method, if we want to get the data as a double type value.

Getting a double type data as user input (NextDouble-Method)

package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double storesdouble = scanner.nextDouble();
System.out.println(storesdouble);
}
}

So, if you try implementing the above program, you will see that we can accept double-type input from the user.