samedi 10 octobre 2015

Get local field from static method with Java reflection

Is it possible to do this? For example, what would the contents of ReflectorClass.getString() need to be for this code to print the contents of someString?

public class Start {
  public static void main(String[] args) {
    String someString = "Hello world!";

    System.out.println(ReflectorClass.getString());
  }
}





Aucun commentaire:

Enregistrer un commentaire