How do I get the name of a variable in Java?
Possible duplicate:
Java Reflection: how to get variable name?
I have found various discussions on this topic, but have never answered them.
A anyVariableName = new A();
How can I get the name of the variable anyVariableName
and get the string "anyVariableName"
in the result? Is this possible in Java?
+3
source to share