QUESTION IMAGE
Question
consider the following fragments of java code
import java.util.*;
public class scannerinput{
public static void main(string args){
scanner keyboard = new scanner(system.in);
system.out.print(\enter a number:\);
double input =
}
}
which of the following should be used to fill the blank? remember to look at the name of the scanner object and the type of data that is being read.
input.nextdouble();
keyboard.nextdouble();
double.nextdouble();
The Scanner object created is named "keyboard", and the data type to be read is double. The correct method to read a double value using a Scanner object is nextDouble(), which must be called on the Scanner instance ("keyboard").
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
keyboard.nextDouble();