-
Scanner (read in) problem. P;ease HELP
Hi all
i am using netbeans 4.1 and JCreator.
my problem is that i wish to read in from the keyboard but i get errors.
import java.io.*;
import java.lang.*;
import java.util.*;
class Hospital{
public static void main (String[] args){
int num;
Scanner sc = new Scanner(System.in);
System.out.println("**********HOPSPITAL**********\n\n");
System.out.println("Please choose the correct number");
num = sc.next ();
The error i get is:
--------------------Configuration: <Default>--------------------
C:\Hospital.java:14: cannot resolve symbol
symbol : class Scanner
location: class Hospital
Scanner sc = new Scanner(System.in);
^
C:\Hospital.java:14: cannot resolve symbol
symbol : class Scanner
location: class Hospital
Scanner sc = new Scanner(System.in);
^
2 errors
Process completed.
Please Help
-
You have not imported the Scanner class into your project. This class was added by Java 1.5. It sounds as if you are not running this version of the jdk.
Last edited by nspils; 12-04-2005 at 12:00 PM.
Similar Threads
-
By mail2vinaybabu in forum Java
Replies: 10
Last Post: 02-27-2005, 01:07 PM
-
Replies: 1
Last Post: 02-26-2005, 09:50 AM
-
Replies: 0
Last Post: 08-09-2003, 02:04 AM
-
Replies: 0
Last Post: 10-30-2002, 04:40 AM
-
Replies: 1
Last Post: 06-06-2001, 10:57 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks