Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

import java.util.*; public class scannerinput{ public static void main(…

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();

Explanation:

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.

Answer:

keyboard.nextInt();