Given the class:
class Statics {
public static String LOC_MY_SELECTOR;
static void find(String selector) {
System.out.println(selector);
}
public static void main(String...args) {
find(LOC_MY_SELECTOR);
}
}
How am I able to, at the point of System.out.println
get the field name, rather than the value? The value is null
, so of course it will print out null. What I want to do, is:
find(LOC_MY_SELECTOR); // to print "LOC_MY_SELECTOR" instead of the value `null`
Is this even possible?
Aucun commentaire:
Enregistrer un commentaire