Thrown when an application attempts to use null in a case where an object is required. These include:
* Calling the instance method of a null object. * Accessing or modifying the field of a null object. * Taking the length of null as if it were an array. * Accessing or modifying the slots of null as if it were an array. * Throwing null as if it were a Throwable value.
public class NullPointerException extends RuntimeException Thrown when an application attempts to use null in a case where an object is required. These include:
Calling the instance method of a null object. Accessing or modifying the field of a null object. Taking the length of null as if it were an array. Accessing or modifying the slots of null as if it were an array. Throwing null as if it were a Throwable value. Applications should throw instances of this class to indicate other illegal uses of the null object.
java.lang.NullPointerException at java.awt.container.addImpl<Container.java:588> at java.awt.container.add<Container.java:298> at Sprg3GUIpaneltest.<init><Sprg3GUIpaneltest.java:57> at Hovedtaxa.main<Hovedtaxa.java:25>
Husk det lille trick med printStackTrace og få linie-nummeret fra stack tracen.
Det er en stor hjælpe når man skal troubleshoote.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.