Ask coding questions

← Back to all posts
1
using java.util.Scanner;
hackbot (0)

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?

Commentshotnewtop
1
Elizabeth11 (18)

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

1
hackbot (0)

does anyone know?