Reputation: 13
import util.java.Scanner;
class Anagram
{
public static void main(String args[])
{
String s1=new String();
Scanner s=new Scanner(System.in);
s1=s.nextLine();
}
}
This gives error :
cannot find symbol Scanner....
whats wrong here?
Upvotes: 0
Views: 130
Reputation: 35557
Scanner
class in java.util.Scanner
package. Import you are using here is incorrect. I suggest you to use IDE to do coding since this kind of issues easily identify by then.
Upvotes: 0
Reputation: 3019
The import you have is wrong.
It should be:
import java.util.Scanner;
instead of
import util.java.Scanner;
Upvotes: 3
Reputation: 13556
The correct import statement is java.util.Scanner
.
For avoiding these kind of errors, its good to use and IDE.
Upvotes: 4