Reputation: 1
import java.util.Scanner;
public class System {
public static void main(String[]args){
Scanner scan = new Scanner(System.in);
String cName, cContact, cAddress, cIC, cDob, cGender;
int i;
}
}
Sorry if this was a repost, but i've searched high and low for a good answer, some suggested having to import java.util.Scanner which i already have, the problem is compiler kept having the error at line Scanner scan = new Scanner(System.in);
"cannot find symbol
symbol: variable in
location: class System"
?! is the library corrupted or something? using NetBeans IDE 8.0.1.
Upvotes: 0
Views: 88
Reputation: 11
Try not to use the names System or Scanner for your public class or any other class in your project. For example:
import java.util.Scanner;
public class ChangeName{ //change the name of the class here. do not name it System or Scanner
public static void main(String[]args){
Scanner scan = new Scanner(System.in);
String cName, cContact, cAddress, cIC, cDob, cGender;
int i;
}
}
I hope this help you!
Upvotes: 1