File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SOS: i have some questions about Thread

 
kevin saber
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


this will cause NullPointerException when i run it, but i don't understand why...
 
Ankit Garg
Sheriff
Posts: 9495
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
kevin saber
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh~~ i would have simply thought that c have pointed to an object by mistake as line 9 showed.
thank you!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic