Would like examples of NullPointerExceptions for tool testing

A

Alistair Hutton

Desipte the ease with which I produce NullPointerExceptions
normally while programming I'm having a hard time coming up
with them to construct an example problem to demonstrate the
functionallity of the tool in my supplied docs. As a result
I'm wondering if any of you exceedingly helpful people would
be able to come up with a short example program/set of
classes that display a classic Null Pointer problem or better
yet, point me too a web page which has such an example on it.
 
R

Roedy Green

Desipte the ease with which I produce NullPointerExceptions
normally while programming I'm having a hard time coming up
with them to construct an example problem to demonstrate the
functionallity of the tool in my supplied docs. As a result
I'm wondering if any of you exceedingly helpful people would
be able to come up with a short example program/set of
classes that display a classic Null Pointer problem or better
yet, point me too a web page which has such an example on it.

One of the most common ones goes like this:

Button[] b = new Button[3];

b[0].setForeground( Color.red );
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top