Skip to content
← Back to Community
using java.util.Scanner;
Profile icon
hackbot

Lately I've been trying to create that involves mostly user input. Yet, I can't ever seem to be able to load the java.util.Scanner file on repl. Can someone tell me how please?

Voters
Profile icon
rsolmeo
Profile icon
umether1
Profile icon
OscarOrellana
Profile icon
tl-hvdyhhvdyh
Profile icon
hackbot
Comments
hotnewtop
Profile icon
Elizabeth11

Here's an example repl.it that uses scanner. https://repl.it/@Elizabeth11/Java-Scanner-Practice

Here are the steps:

  1. Type this before the class main (first line in your code) import java.util.Scanner;
  2. Then in your main code create a scanner (I called mine in)
    Scanner name = new Scanner(System.in);
  3. Then use the .nextLine() to get string input and .nextInt() for integer input.

Please let me know if this helped or if you have any questions

Profile icon
hackbot

does anyone know?

Profile icon
JackTheJavaDev

hi