• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Java get variable by string

Bigbacon

Fully [H]
2FA
Joined
Jul 12, 2007
Messages
22,541
I am not a java person so I am trying to figure this out.

I want to be able to get an object by using a string to get it.

I may not be explaining that well so I'll try to explain the only way I know how.

So in VB.net you can do something like

Dim b as textbox = form1.findControl(String) C# has a similar thing as well.

Is there a java equivalent to this?
 
You could always use a hashmap

Map<String, MyType> foo = new HashMap<String, MyType>();

foo.put("blah", new MyType());

later..

MyType something = foo.get("blah");
 
Back
Top