| Author |
SOS: i have some questions about Thread
|
kevin saber
Greenhorn
Joined: Mar 07, 2010
Posts: 21
|
|
this will cause NullPointerException when i run it, but i don't understand why...
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9191
|
|
In the go method, the two Test5 objects with which you create 2 threads both have Chicks as null, so calling yack in the run method causes NPE. Try this
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
kevin saber
Greenhorn
Joined: Mar 07, 2010
Posts: 21
|
|
oh~~ i would have simply thought that c have pointed to an object by mistake as line 9 showed.
thank you!!!
|
 |
 |
|
|
subject: SOS: i have some questions about Thread
|
|
|