QUESTION IMAGE
Question
import java.util.*;
public class scannerinput{
public static void main(string args){
scanner keyboard = new scanner(system.in);
system.out.print(\enter a number: \);
int input =
}
}
which of the following should be used to fill the blank?
keyboard.next();
input.next();
keyboard.nextint();
Step1: Analyze the Scanner object
The Scanner object is named keyboard. To read an int value, the appropriate method for a Scanner object is used.
Step2: Check the method for reading int
The nextInt() method of the Scanner class is used to read an integer. So keyboard.nextInt() is the correct call.
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.nextInt();