Scanner is a Java class. All classes in Java should start with a capital letter.

Change

java.util.scanner;

to

java.util.Scanner;
Answer from David.Jones on Stack Overflow
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 310948 › why-cant-i-import-java-util-scanner
Why cant i import java.util.scanner? [SOLVED] | DaniWeb
Common causes of "cannot import java.util.Scanner" in Eclipse Helios are build path and JRE configuration, not the IDE itself.
Discussions

java - "Cannot be resolved to a type" when attempting to use Scanner - Stack Overflow
when i run following code it shows error that scanner cannot be resolved to type. i checked that jre is installed and version is 1.7 what else do i need to check ? please help. public class studen... More on stackoverflow.com
🌐 stackoverflow.com
methods - Can't import java.util.Scanner - Stack Overflow
I have been trying to create program that lets a user input a number of eggs to buy and calculates the price. I have tried using the scanner method to input the integer, but I can't seem to import ... More on stackoverflow.com
🌐 stackoverflow.com
Can't import java.util.scanner, even though have downloaded new JDK

Scanner needs a capital S. Class names in Java are always capitalised.

More on reddit.com
🌐 r/IntelliJIDEA
5
1
November 12, 2019
java - "cannot find symbol - class Scanner" error - Stack Overflow
You need to include the line import java.util.Scanner; in your source file somewhere, preferably at the top. ... Save this answer. ... Show activity on this post. You can resolve this error by importing the java.util.* package - you can do this by adding following line of code to top of your program (with your other import statements): ... Save this answer. ... Show activity on this post. sometimes this can occur during when we try to print string from the user so before ... More on stackoverflow.com
🌐 stackoverflow.com
Top answer
1 of 3
2
What IDE do you use? Notepad, eclipse, IntelliJ? Does a normal System.out.println(„Hello World“); in a main method work? Make sure you have a valid Java SDK installed, and that your project is configured to use the correct Java version. After you did that refresh the project, maybe restart your ide and check if it works :)
2 of 3
1
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Java-Scanner-import
Java Scanner import
If you get the “Scanner cannot be resolved to a type” error message, just add the Java Scanner import statement to your code, or explicitly reference the package when you use the Scanner class in your code.
Published: February 12, 2026
🌐
Coderanch
coderanch.com › t › 668716 › java › error-scanner-resolved-type
error scanner cannot be resolved to a type (Beginning Java forum at Coderanch)
Tapas Chand wrote:The error is because Scanner class does not have a constructor taking PrintStream as argument. You should provide InputStream.
Find elsewhere
🌐
Reddit
reddit.com › r/intellijidea › can't import java.util.scanner, even though have downloaded new jdk
r/IntelliJIDEA on Reddit: Can't import java.util.scanner, even though have downloaded new JDK
November 12, 2019 -

The problem is basically stated in the title. I've tried everything I could think of and what I have found in Google but nothing could resolve my problem. I'm currently running Java 11.02 on IntelliJ community edition (but have also tried with 11, no success though). The "java.util.scanner" isn't even underlined with a wavy red, but instead the word "scanner" is shown in red, the title is underlined though.

Does anyone know what I could try?

🌐
Coderanch
coderanch.com › t › 405551 › java › import-java-util-Scanner-issues
import java.util.Scanner issues (Beginning Java forum at Coderanch)
I've been searching around online for other Java tutorials (now have a few good ones plus the Head First Java book) and came across java.util.Scanner in a practical exercise. If I compile the code in an ide (which I know everyone hates for beginners) it compiles fine. If I compile from the command line, using javac LoopingLock.java, I get compile errors stating.. LoopLock.java:1: cannot resolve symbol symbol: class Scanner location: package util import java.util.Scanner; ^ And other various compile errors complaining about me trying to use Scanner.
🌐
Reddit
reddit.com › r/learnprogramming › [java] import java.util.scanner not being recognized?
r/learnprogramming on Reddit: [Java] import java.util.Scanner not being recognized?
January 14, 2018 -

I'm trying to import the scanner class into my program (I'm using NetBeans) but when I type "import java.util.Scanner;" I get an error that says "cannot find symbol: class Scanner"

I thought maybe I typed it wrong so I even copy and pasted the line from code on a different working project and it's still saying that. Not sure where to go from here. Anyone know what could be causing this error?

🌐
Reddit
reddit.com › r/javahelp › error with declaring scanner in dr java. scanner cannot be resolved to a type. any advice would help.
r/javahelp on Reddit: Error with declaring Scanner in Dr Java. Scanner cannot be resolved to a type. Any advice would help.
March 28, 2015 -

So as the title suggests I am having issues declaring the scanner in Dr Java (I need to use this program for uni). Error states: 'scanner cannot he resolved to a type' code I've used is:

import java.util.Scanner; scanner sc = new scanner(system.in);

The errors are showing to the new scanner line specifically. I am running the latest, stable version of Dr java and have Googled the error extensively without much luck. Any advice would be appreciated.

Thanks.

🌐
Stack Overflow
stackoverflow.com › questions › 21821474 › how-to-resolve-the-error-while-using-scanner-class-in-java
how to resolve the error while using Scanner class in java - Stack Overflow
May 22, 2017 - Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... import java.util.Scanner; class My { public static void main(String[] args) { int val; Scanner sc = new Scanner(System.in); System.out.println("Enter no = "); val= sc.nextInt(); System.out.println("number " + val); } } ... My.java:1: cannot resolve symbolsymbol : class Scanner location: package util import java.util.Scanner; My.java:8: cannot resolve symbol symbol : class Scanner location: package util java.util.Scanner scanner = new java.util.Scanner(System.in); My.java:8: cannot resolve symbol symbol : class Scanner location: package util java.util.Scanner scanner = new java.util.Scanner(System.in);
🌐
Tek-Tips
tek-tips.com › home › forums › software › programmers › languages › java
The import java.util.scanner cannot be resolved error | Tek-Tips
May 16, 2012 - Sorry, I was a bit too fast it should read the line "import java.util.scanner" is invalid, because Scanner must be written with a capital "S" Valid is: import java.util.Scanner
🌐
Code with Mosh
forum.codewithmosh.com › java
Cannot resolve symbol 'Scanner' - Java - Code with Mosh Forum
May 5, 2021 - i am studying java fundamentals using Intellij IDE. but there is some errors but no issues in output. Cannot resolve symbol ‘Scanner’. Cannot resolve method ‘print(java.lang.String)’. Cannot resolve method ‘nextLine()’…
🌐
Stack Overflow
stackoverflow.com › questions › 42033544 › java-util-scanner-cannot-be-resolved
java.util.Scanner cannot be resolved - Stack Overflow
February 4, 2017 - Note: When I change the import to import java.util.* I receive no further errors on the import but the Scanner instance still errors. Update: I took a print screen if it helps anyone. Resolved because I updated my Java, I had to manually tell Eclipse my JDK path.
🌐
Tek-Tips
tek-tips.com › home › forums › software › programmers › languages › java
New to Java getting error: Scanner cannot be resolved or is not a type | Tek-Tips
February 18, 2006 - Code is the following: import java.util.*; public class FirstProject { public static void main(String[] args) { System.out.println("Hello out there."); System.out.println("I will add two numbers for you."); System.out.println("Enter two whole numbers on a line:"); int n1, n2; Scanner keyboard = new Scanner(System.in); n1 = keyboard.nextInt( ); n2 = keyboard.nextInt( ); System.out.println("The sum of those two numbers is"); System.out.println(n1 + n2); } } Error is: Scanner cannot be resolved or is not a type The import java.util is never used Today I went to the following link: https://sdlcweb2d.sun.com/ECom/EComActionServlet;jsessionid=C7F951B9667B8A7C63CF7BA88A714429 and downloaded jdk-1_5_0_06-windows-i586-p-iftw.exe I installed it but I am still getting the same error.
🌐
The Eclipse Foundation
eclipse.org › forums › index.php › t › 160778
Eclipse Community Forums: Newcomers » Problems with Java Scanner on Eclipse.. | The Eclipse Foundation
January 15, 2010 - The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 350 open source projects, including runtimes, tools and frameworks.