Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using Class<?> Class.forName() generic info

843793Jul 3 2007 — edited Jul 15 2007
Hi,

how do I get advantage of the generic information in Class.forName method?

I actually have the code:
Class<?> myClass= Class.forName(myString);
and I want a generic type for myClass (let T), so that later on I can create instances of myClass using:
T myInstance = myClass.newInstance();
How is this possible?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2007
Added on Jul 3 2007
3 comments
286 views