I know that this is a noobish error but I don’t know how to fix it.
public static void main (String args[]){
Console kitty = System.console();
String username = kitty.readLine("Username: ");
}
String username = kitty.readLine(“Username: “);
produces the error. Can someone please tell me what I am doing wrong, Thank you.
If you want to read the username from the standard input, you could use this code:
The Console returned by System.console() does not necessarily exist, that is why you get a NullPointerException.