how can I convert string to data type?

kenng

Newcomer
Joined
Aug 31, 2003
Messages
3
If I have a string abc,
String abc = "int";

how can I declare some variables using abc's value as data type?:confused:

Really thx =0=
 
Not very easily, I don't think. You might be able to do it with Reflection, but it shouldn't be necessary. You can just use the Object datatype to hold whatever value you need.
 
Thx for your advice!

but actually, I really want to use such method to solve my problem.

coz I write some code to get other classes function name by looping vector. I get those name and datatype in string format.
I need to call them in my class =__________=

(p.s hope that you know my meaning, poor english /___\)
 
Whatever you're trying to do, you can be sure there's a better way of doing it than specifying a type name (which is compiler specific) in a string at runtime.
 
Back
Top