Problem with reflection

Joined
Jan 10, 2008
Messages
2
Reaction score
0
Hi,

I have a small doubt in Java Reflection.

I pass in the name of a java class and a value(in byte[]) of that type as arguments to a function.

I want my function to create an object to that class and intiailise it with that value that is passed as an argument.

How do I achieve this?

Code:
suppose I has passed arguments: java.lang.String, byte[]"Sample String"

Object obj = Class.forName("java.lang.String").newInstance();

now how do I change the byte array's value and initialise my object.

Any help would be greatly appreciated.
thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,347
Messages
2,571,451
Members
48,794
Latest member
Lonell Lee

Latest Threads

Top