promotion image of download ymail app
Promoted

Why Java NullPointerException error is generated when calling a method that throws InterruptedException?

3 Answers

Relevance
  • Anonymous
    1 year ago

    There's a null pointer exception that has occurred

    • Commenter avatarLog in to reply to the answers
  • 1 year ago

    Because the instance of the object that owns the method is null. You are trying to reference non-existent object!

    • Commenter avatarLog in to reply to the answers
  • Arch
    Lv 7
    1 year ago

    Generally, the Java NullPointerException is caused by class being instantiated not being in your classpath. Are you sure that's not the case here?

    Perhaps, it is "InterruptedException" that you have not imported, or that isn't in your classpath?

    Edit to add: Is this happening when you compile/build? Or are you successfully building, then exporting to a different system and encountering the error when you run it? If it is the latter, check the classpath on that system and make sure that the .jar file containing InterruptedException is in that classpath.

    • Commenter avatarLog in to reply to the answers
Still have questions? Get answers by asking now.