Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

which program was used to generate the code fragments? input.next(); sc…

Question

which program was used to generate the code fragments? input.next(); scanner.input(); keyboard.nextline();

Explanation:

Brief Explanations

The code fragment uses a Scanner object named keyboard (initialized as new Scanner(System.in)). To read a line of text input, the correct method for a Scanner object is nextLine(). The variable name for the Scanner is keyboard, so the valid call is keyboard.nextLine().

Answer:

keyboard.nextLine();