Error Cannot Resolve Symbol Class Scanner
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site cannot find symbol class scanner About Us Learn more about Stack Overflow the company Business Learn more about
Cannot Resolve Symbol Error In Java
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss android studio error cannot resolve symbol r Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up how to resolve the cannot resolve symbol c# error while using Scanner class in java up vote -1 down vote favorite I have created a class "My" in which i am simply taking input from user using Scanner class" 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); } } But I am getting
Cannot Resolve Symbol Intellij
following errors: 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); java share|improve this question edited Feb 17 '14 at 5:54 asked Feb 17 '14 at 5:33 Saher Basharti 13 Remove
in the code snapts –Abimaran Kugathasan Feb 17 '14 at 5:34 created Scanner object as "scanner" but used as "sc" –Vishal Santharam Feb 17 '14 at 5:37 what is sc in your code??? change your line to val = scanner.nextInt(); –Ankit Lamba Feb 17 '14 at 5:39 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote `import java.util.Scanner;` You can keep the name sc for your Scanner but change `java.util.Scanner` in the body of your code to `Scanner` as you don't need to call the imported package to declare the object. Update 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 = ");
This Site Careers Other all forums Forum: Beginning Java "cannot resolve symbol" error when compiling... Nick Garcia Greenhorn Posts: 15 posted 7 years ago Hello, So, in the middle of one of my cannot resolve symbol context homework assignments, I start getting this error in relation to the scanner class. cannot resolve symbol intent I thought it might be an error in my code, but I couldn't find any. So I made a completely
Cannot Resolve Symbol Actionbaractivity
new project that would simply test out using the scanner class. No dice. I don't know what I'm doing wrong here. I've looked through the API in relation to the Scanner class http://stackoverflow.com/questions/21821474/how-to-resolve-the-error-while-using-scanner-class-in-java and everything seems to check okay. import java.util.Scanner; public class ScanDemo1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String input = sc.next(); System.out.println(input); } } When this runs, the command prompt shows: C:\java\projects>javac ScanDemo1.java ScanDemo1.java:1: cannot resolve symbol symbol : class Scanner location: package util import java.util.Scanner; ^ ScanDemo1.java:7: cannot resolve symbol symbol : class Scanner location: class ScanDemo1 Scanner sc https://coderanch.com/t/431866/java/java/resolve-symbol-error-compiling = new Scanner(System.in); ^ ScanDemo1.java:7: cannot resolve symbol symbol : class Scanner location: class ScanDemo1 Scanner sc = new Scanner(System.in); ^ 3 errors C:\java\projects> I don't really understand where the compiler is having trouble. Any suggestions? NOTE: When posting this, I realized the arrows wouldn't point to what I was seeing, and would instead go to the beginning of the line. I made the letters that the arrows were pointing at BOLD so that you'd see what I was seeing. Except, on the third arrow, I tried making the equals sign (=) bold, but that didn't seem to do much. So, on the third error, the arrow is pointing at the equals sign. Thanks a ton! Carpe diem, because every day is worth living to its fullest. Jiken Jarecha Greenhorn Posts: 9 posted 7 years ago http://www.coderanch.com/t/431655/Java-General-beginner/java/Symbol-Class-error-no-package This may help Nick Garcia Greenhorn Posts: 15 posted 7 years ago I'm sorry. I don't fully understand what went on during that post. Do you think my classpath might be incorrect? Everything else java related seems to run flawlessly until I try out the scanner class. Is it possible that when I say: import
found in java.util Summary: https://netbeans.org/bugzilla/show_bug.cgi?id=64867 Scanner Class not found in java.util Status: RESOLVED INVALID Product: java Classification: Unclassified Component: Project Version: 5.x Hardware: Macintosh Mac OS X Priority: P3 (vote) TargetMilestone: 6.x Assigned To: issues@java QA Contact: issues@java URL: Whiteboard: Keywords: Depends on: Blocks: Show dependency tree /graph Reported: 2005-09-22 04:39 UTC cannot resolve by akamarcus Modified: 2006-12-19 09:34 UTC (History) CC List: 0 users See Also: Issue Type: DEFECT Exception Report : Attachments Experimental Project for review (9.25 KB, application/x-compressed) 2005-09-23 16:48 UTC, akamarcus Details Revision of previous program - issues w/scanner class (9.02 KB, application/x-compressed) 2005-09-23 18:20 UTC, akamarcus Details View cannot resolve symbol All Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description akamarcus 2005-09-22 04:39:36 UTC I was trying out the scanner class to experiment with it. I entered \ import java.util.Scanner; public class Echo { public static void main (String[] args) { String message; Scanner scan = new Scanner (System.in); System.out.println ("Enter a line of text:"); message = scan.nextLine(); System.out.println ("You entered: \"" + message + "\""); } } and it gave me these compiler errors: init: deps-jar: Compiling 1 source file to /Users/Mark/Documents/Mark/BYU Classes/Computer Science 142/Experimental/build/classes /Users/Mark/Documents/Mark/BYU Classes/Computer Science 142/Experimental/src/experimental/Echo.java:1: cannot resolve symbol symbol : class scanner location: package util import java.util.scanner; /Users/Mark/Documents/Mark/BYU Classes/Computer Science 142/Experimental/src/experimental/Echo.java:8: cannot resolve symbol symbol : class Scanner location: class Echo Scanner scan = new Scanner (System.in); /Users/Mark/Documents/Mark/BYU Classes/Computer Science 142/Experimental/src/experimental/Echo.java:8: cannot resolve symbol s