I just started learning some Java and I made this simple program but I dont know whats wrong with my code.
This is what the error I see when I run:
Exception in thread "main" java.lang.NullPointerException at treehousejava.Main.main(Main.java:9)
This is my code:
package treehousejava;
import java.io.Console;
public class Main {
@SuppressWarnings("unused")
public static void main (String[] args){
Console console = System.console();
String q = console.readLine("Hi there! what's your name? ");
console.printf("hi there %s ! my name is console! ");
}
}