Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

The import "java.util.scanner" is not vaild

807601Feb 11 2008 — edited Feb 11 2008
I am experiment with the java.util.scanner API after compiling the code below I received the following error:

The import "java.util.Scanner" is not valid, since it does not name a type in a package.

I declared a string variable should that suffice?



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 something:");

message = scan.nextLine();

System.out.println ("hey you entered: \"" + message + "\"");

}

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2008
Added on Feb 11 2008
4 comments
822 views