0

how to access the name of array. is there any way to do this.

21st Feb 2017, 5:21 PM
shobhit
shobhit - avatar
2 Answers
+ 7
You should first read the information ChaoticDawg posted to understand reflections. And here is another 'short' example which you can use, once you got it (Java8): http://www.javaquery.com/2015/04/how-to-get-fieldsvariables-name-and.html?m=1
21st Feb 2017, 6:37 PM
Tashi N
Tashi N - avatar
+ 3
Depending on the version of Java that your using and whether it is a class member you may be able to achieve this via reflection. https://docs.oracle.com/javase/tutorial/reflect/class/classMembers.html
21st Feb 2017, 5:40 PM
ChaoticDawg
ChaoticDawg - avatar