Error Cannot Find Symbol Scanner In = New Scannersystem.in
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 About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss 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 do I fix a 'cannot find symbol' error in Java (Scanner)? [closed] up vote 1 down vote favorite public class TemperatureChanger { public static void main(String[]args) { Scanner keyboard = new Scanner(System.in); int c; int f; int tempFaren; System.out.println("Enter temperature in celcius"); c = keyboard.nextInt(); tempFaren = (9 *c)/5 + 32; System.out.println( " In Fahrenheit that is " + tempFaren ); } } I'm receiving the error TemperatureChanger.java:7: cannot find symbol Scanner keyboard = new Scanner(System.in) during compilation. What do I need to do to fix this. java share|improve this question edited Apr 27 '13 at 1:20 bmargulies 64.7k26118227 asked Apr 27 '13 at 1:06 javic0 19125 closed as too localized by Stephen C, fglez, A. Rodas, Sindre Sorhus, luke Apr 29 '13 at 12:46 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question. You keep getting it, presumably, because you haven't fixed the mistake that produces it. Looks like you are missing an import for the Scanner class. –bmargulies Apr 27 '13 at 1:08 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote accepted You need to import the Scanner before you use it: Scanner keyboard = new Scanner(System.in); Also I do not know i
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 About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is http://stackoverflow.com/questions/16247270/how-do-i-fix-a-cannot-find-symbol-error-in-java-scanner a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Scanner problems. Split problems. Can't find symbol - java up vote 0 down vote favorite This is what I got returned and I cannot figure out what error: cannot find symbol C:\Users\testuser\Desktop\TestFile.java:33: http://stackoverflow.com/questions/15915425/scanner-problems-split-problems-cant-find-symbol-java error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class TestFile C:\Users\testuser\Desktop\TestFile.java:33: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class TestFile C:\Users\testuser\Desktop\TestFile.java:44: error: cannot find symbol String[] tabs = prep.Split(" "); ^ symbol: method Split(String) location: variable prep of type String 3 errors This is my code. public class TestFile { String[] preps = { "about", "above", "across", "after", "against", "along", "among", "around", "at", "before", "behind", "below", "beneath", "beside", "between", "by", "concerning", "down", "during", "except", "for", "from", "in", "inside", "into", "like", "near", "of", "onto", "out", "over", "through", "to", "toward", "under", "up", "upon", "with", "within", "without" }; String[] errorpreps = { "will", "would", "shall", "should", "can", "could", "may", "might", "must", }; String[] question = { }; public static void main(String[] args) { TestFile f = new TestFile(); f.generatecode("hi"); }; public String generatecode(String code){ Scanner sc = new Scanner(System.in); String inp = sc.nextString(); String prep = "";
IP isWhoisCalculatorTool PointsNewsNews tip?ForumsAll ForumsHot TopicsGalleryInfoHardwareAll FAQsSite FAQDSL FAQCable TechAboutcontactabout uscommunityISP FAQAdd ISPISP Ind. ForumsJoin Search similar:[DSL] Wed 11 Jun, 11am ET, DSL issues[HELP] FXO disconnect issue.How do these get on http://www.dslreports.com/forum/r11575395-Cant-find-scanner-class to a computer?Upgrade Asterisk to an OAUTH2.0 connection with Google Voice[DSL] SmartRG configuration: unclear XML portionsASP page help Forums → The Site → http://www.dreamincode.net/forums/topic/224592-scanner-cannot-find-symbol-errors/ Old Forums → Java → Cant find scanner class...? uniqs1546 Share « Java will not work on XP SP2 • is cjava.exe spyware? error cannot » PToNPremium Memberjoin:2001-10-04Houston, TX PToN Premium Member 2004-Oct-13 11:19 am Cant find scanner class...?Hello, i am taking this class on Java and when i try to compile any of my projects i get a message that the scanner class cant be found. I have tired Jgrasp, NetBeans, error cannot find Kdevelop and others and it still wont work which makes me belive that there is something that i havent installed...The actual error says: " cant find symbol | symbol: class Scanner | location: package java.util"Any ideas...?import java.util.Scanner;public class TempConverter{ public static void main (String[] args) { final int BASE = 32; final double COVERSION_FACTOR = 5.0 / 9.0; double fahrenheitTemp, celsiusTemp; System.out.print ("Please enter Fahrentheit Temperature: "); fahrenheitTemp = scan.nextDouble(); celsiusTemp = fahrenheitTemp - BASE * COVERSION_FACTOR; System.out.println ("Celsius Temperature: " + celsiusTemp); System.out.println ("Farenheit Equivalent: " + fahrenheitTemp); }}thanks · actions · 2004-Oct-13 11:19 am · (locked) GILXA1226MVMjoin:2000-12-29Dayton, OH GILXA1226 MVM 2004-Oct-13 1:10 pm try makeing the import line just like this:import java.util.*; · actions · 2004-Oct-13 1:10 pm · (locked) GILXA1226 GILXA1226 to PToN MVM 2004-Oct-13 1:53 pm to PToNupon further inspection of your code where ar
Reply 5 Replies - 4795 Views - Last Post: 27 March 2011 - 12:23 PM Rate Topic: #1 Wis3boi New D.I.C Head Reputation: 0 Posts: 5 Joined: 28-February 11 Scanner: Cannot Find Symbol Errors Posted 27 March 2011 - 10:42 AM Greetings everyone! I have this java program that converts measurements that the user inputs from a menu. When I compile it I get the following two errors that I've never seen before: Conversion.java:27: cannot find symbol symbol : variable keyboard location: class Conversion choice = keyboard.nextLine(); ----------^ Conversion.java:29: incompatible types Found : java.lang.String required: int switch (choice) --------^ 2 errors And here is my code below. I'm not sure how I could solve these errors...perhaps I worded something wrong. import java.util.Scanner; public class Conversion { public static void main(String[] args) { double meters; Scanner keyboard = new Scanner(System.in); System.out.print("Enter a distance in meters: "); meters = keyboard.nextDouble(); if (meters < 1) System.out.print("Please enter a positive number!"); menu(meters); } public static void menu(double meters) { //display a menu of choices for the user String choice; System.out.println("1. Convert to kilometers "); System.out.println("2. Convert to inches "); System.out.println("3. Convert to feet "); System.out.println("4. Quit the program "); System.out.println(); System.out.println(); System.out.println("Enter your choice: "); choice = keyboard.nextLine(); switch (choice) { case 1: showKilometers(meters); break; case 2: showInches(meters); case 3: showFeet(meters); break; case 4: System.out.println("Bye!"); System.exit(0); break; default: System.out.println("Not valid, try again please."); } } public static void showKilometers(double meters) { //calculate for kilometers Double kilo; kilo = meters * 0.001; System.out.println(meters + " meters is " + kilo + " kilometers."); } public static void showInches(double meters) { //calculate for inches double inch; inch = meters * 39.37; System.out.println(meters + " meters is " + inch + " inches."); } public static void showFeet(double meters) { //calculate for feet double feet; feet = meters * 3.281; System.out.println(meters + " meters is " + feet + " feet."); } } This post has been edited by macosxnerd101: 27 March 2011 - 10:59 PM Reason for edit:: Title renamed to be more descriptive Is This A Good Question/Topic? 0 Back to top MultiQuote Quote + Rep