aspose file tools*
The moose likes Beginning Java and the fly likes NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NullPointerException" Watch "NullPointerException" New topic
Author

NullPointerException

Abhimanyu Rathore
Ranch Hand

Joined: Jan 23, 2010
Posts: 32

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

Joined: Aug 23, 2010
Posts: 49
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.


Regards,
Sudipta Kumar Laha
Abhimanyu Rathore
Ranch Hand

Joined: Jan 23, 2010
Posts: 32

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

Joined: Oct 13, 2005
Posts: 36575
    
  16
... and welcome to the Ranch
Abhimanyu Rathore
Ranch Hand

Joined: Jan 23, 2010
Posts: 32

Campbell Ritchie wrote:... and welcome to the Ranch

Thanks Campbell
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NullPointerException
 
Similar Threads
Scope and classes/methods
why this causing error
do something when other frame close
Why runtime exception thrown is this code