Suppose a scanner object is created as follows: scanner input = new scanner(system.in); the method you use to read a real number is Scanner input = new Scanner(System.in); input. nextDouble();
This is because the Scanner input = new Scanner(System.in); input. nextDouble(); command creates the input for a number that contains both whole numbers and decimal numbers and this is why double is used and not int.
<h3>What is a Double in Programming?</h3>
This refers to the fundamental data type that is encoded into the compiler and used to define numeric variables holding numbers with decimal points
Hence, we can see that Suppose a scanner object is created as follows: scanner input = new scanner(system.in); the method you use to read a real number is Scanner input = new Scanner(System.in); input. nextDouble();
This is because the Scanner input = new Scanner(System.in); input. nextDouble(); command creates the input for a number that contains both whole numbers and decimal numbers and this is why double is used and not int.
Read more about double and float here:
brainly.com/question/13260053
#SPJ1