wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes issue with obtaining class name from Object passed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "issue with obtaining class name from Object passed" Watch "issue with obtaining class name from Object passed" New topic
Author

issue with obtaining class name from Object passed

El Durango
Greenhorn

Joined: Oct 09, 2003
Posts: 23
I have a simple program that demonstrates the usage of interfaces and I have an issue with obtaining a classname from an object passed to the class constructor.
Here is some code to clarify this:

and here is the class that calls this class:

I do not understand why the segment within the FactoryClass constructor gives error.
If anyone can I would appreciate it alot.
regards,
Durango
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34


The stack trace is a NullPointerException, right? Look at the above two lines: you're passing "null" as the argument to the FactoryClass constructor. The FactoryClass constructor calls a method on the passed-in argument, which gives the NullPointerException. You can't call a method on the null reference.
OK?


[Jess in Action][AskingGoodQuestions]
El Durango
Greenhorn

Joined: Oct 09, 2003
Posts: 23
*Doh!!!*
thanks dude!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: issue with obtaining class name from Object passed
 
Similar Threads
Loading POJO object without loading library first
Java Generics Warning
Exception in thread "main"
How to Load Serialized Plugins?
[newbie] IllegalAccessException