When I execute this code...
import java.io.Console;
import java.lang.String;
public class Beginning
{
public static void main(String[] args)
{
Console pass = System.console();
String username = pass.readLine("Enter username here -> "); //line 1
char password[] = pass.readPassword("Enter password here -> ");
System.out.println(username);
}
}
... I get the following error - Exception in thread "main" java.lang.NullPointerException
at the line 1 marked in the code. How can I correct this? I have read few other NullPointerException answers but still can't seem to solve my problem. (I'm a beginner, btw)