Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic class loading

 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. here is my problem




Please note the commented code snippet. I would like to dynamically load a class and pass it as an argument to the displayDocument() method.

However


is not valid, as they are incompatible conditional operand types. How do I get around this?

P.S: Interestingly, c.getInterfaces() returns an empty array (I expected it to return DocumentProviderIntf).

[ June 28, 2006: Message edited by: Lynette Dawson ]
[ June 28, 2006: Message edited by: Lynette Dawson ]
 
Lionel Port
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You only have the Class. You need to create an instance of the class.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic