Results 1 to 5 of 5
Thread: java.util.Scanner not recognised
- 06-04-2008, 08:19 PM #1
Member
- Join Date
- Jun 2008
- Posts
- 5
- Rep Power
- 0
java.util.Scanner not recognised
Hi. I am writing a parser for a constructor that takes a String parameter and want to use a scanner class. I have confirmed I am using 1.5.0 (see output from command line below) and have imported java.util.* however when I compile I get the following errors
Can anyone help me to fix this problem?Java Code:$ javac *.java 2. ERROR in Argument.java (at line 46) Scanner scan=new Scanner(); ^^^^^^^ Scanner cannot be resolved to a type ---------- 3. ERROR in Argument.java (at line 46) Scanner scan=new Scanner(); ^^^^^^^ Scanner cannot be resolved to a type ---------- 2 problems (2 errors)
Thanks :)
java -version output:
(PS I hope I posted this in the right place, it's my first time here)Java Code:$ java -version java version "1.5.0" gij (GNU libgcj) version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)
-
Are you importing the Scanner class properly with
?Java Code:import java.util.Scanner;
- 06-05-2008, 03:53 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yes, it should be. Check that you have import the required package.
- 06-05-2008, 06:30 AM #4
all Scanner constructors have parameters....$ javac *.java
2. ERROR in Argument.java (at line 46)
Scanner scan=new Scanner();
^^^^^^^
Scanner cannot be resolved to a type
----------
3. ERROR in Argument.java (at line 46)
Scanner scan=new Scanner();
^^^^^^^
Scanner cannot be resolved to a type
----------
2 problems (2 errors)freedom exists in the world of ideas
- 06-07-2008, 03:32 PM #5
Member
- Join Date
- Jun 2008
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
java.util
By Java Tutorial in forum Java TutorialReplies: 1Last Post: 02-07-2008, 01:46 PM -
Using java.util.Scanner to search for a String in a String
By Java Tip in forum Java TipReplies: 0Last Post: 11-20-2007, 04:59 PM -
Using ava.util.Scanner
By Java Tip in forum Java TipReplies: 0Last Post: 11-20-2007, 04:47 PM -
Using java.util.Formatter
By Java Tip in forum Java TipReplies: 0Last Post: 11-16-2007, 02:29 PM -
The import java.util.Scanner cannot be resolved
By Heather in forum Advanced JavaReplies: 1Last Post: 07-08-2007, 01:05 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks