File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

issue with obtaining class name from Object passed

 
El Durango
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
El Durango
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*Doh!!!*
thanks dude!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic