Is there any way to implement this sort of code in Java?
int foo = 3;
String data = "foo";
System.out.println(StringToReference(data));
and print 3
?
Edit: Specifically, I'd like to parse a String
or char
and return an int
representing a KeyEvent
. For example, I'd like to be able to do this:
for(char c : "hello")
new Robot().keyPress(StringToReference("KeyEvent.VK_"+c));
Without knowing exactly what you are trying to accomplish, this is the closest I think you could get:
Map<String, Integer> map = new HashMap<String, Integer>();
map.put("foo", 3);
System.out.println(map.get("foo"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With