• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NullPointerException

 
Abhimanyu Rathore
Ranch Hand
Posts: 32
Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Guys ..
This is my 1st post on Ranch(if you see any mistake please let me know)
This program is compiled fine.. but while running, its throwing an exception
Let me know if i am doing anything wrong

Program


Exception

 
Sudipta Laha
Ranch Hand
Posts: 49
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While creating the Thread you are creating a instance of the ClassA, so the instance of classB is not initialized as we are not calling the go method. For this you are getting the NullPointerException.
 
Abhimanyu Rathore
Ranch Hand
Posts: 32
Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudipta Laha wrote:While creating the Thread you are creating a instance of the ClassA, so the instance of classB is not initialized as we are not calling the go method. For this you are getting the NullPointerException.


Yup! .. that's it..
Thanks a Lot Sudipta.. i appreciate!!..
 
Campbell Ritchie
Sheriff
Posts: 48386
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... and welcome to the Ranch
 
Abhimanyu Rathore
Ranch Hand
Posts: 32
Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:... and welcome to the Ranch

Thanks Campbell
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic