mercredi 31 octobre 2018

'Toolkit not initialized' with io.java

I'm new with Java and NetBeans 8.2 so sorry because this is a stupid question.

I practiced simple Java tasks and finished them successfully. And now added some io.java library (which I had not used before) in my project package. But when I try to run:

 io.title("Perfect weight");
    double height = io.getDouble("Enter your height");
    double weight = 0;
    char ch = io.getChar("Enter m for man and f for woman");
    if (ch == 'f') {
        weight = height - 110;
    }
    if (ch == 'm') {
        weight = height - 100;
    }
    io.println("Your perfect weight is ", weight);

I get this error Exception in thread "main" java.lang.IllegalStateException: Toolkit not initialized

What should I do?

Aucun commentaire:

Enregistrer un commentaire