0
Someone to show me a way to import java util.scanner
3 Answers
+ 3
Thadei import java.util.Scanner; that means you need to import the package of Scanner
Why we need to import this package? Because if take user input then it's need to import the package of Scanner and also define the Scanner class, full detail please learn the course 'Introduction to Java'.
+ 2
Write the import statement at the beginning of your code.
import java.util.Scanner;
This is covered in the Control Flow chapter of the introduction to Java course.
Pay attention to lowercase/uppercase letters, they can be a common source of errors.
+ 1
import java.util.Scanner;
That line imports scanner
Place it at the first line of your code.
Later you can use it like this:
Scanner scanner = new Scanner(System.in);
int variable = scanner.nextInt();
Use sololearn course to learn that https://www.sololearn.com/Course/java-introduction/?ref=app