I can't solve the problem two hours. Please help me.
My code:
package work.anart;
import java.io.Console;
public class Office {
public static void main(String[] args) {
Console cons = System.console();
cons.printf("\n");
String nbook = "Notebook";
double price = 1.75;
cons.printf(" 1 %10s worth %.2f euro \n", nbook, price);
cons.printf(" 1 %10s worth %.2f euro \n", nbook, price);
}
}
Run:
Exception in thread "main" java.lang.NullPointerException
at work.anart.Office.main(Office.java:8)
Java Result: 1