我正在尝试从方法数组中调用静态方法.这在调试器中工作得很好,但在正常运行模式下不行.这是为什么?
以下代码注释中的更多描述..
编辑以便于再现只需在调试器与普通模式下运行此类:
public class Stackoverflowquestion {
public static class Backautomat {
private String aktuellBackendeBrotsorte = "Butterbrot";
//Test für Statische Methoden: Brauche ich dazu auch eine Instanz für Invoke?
public static String getBezeichnung(){
return "Bezeichnung: Bester-Backautomat-Ever";
}
//Test für Methoden ohne Parameterliste
public boolean backautomat_starten(){
return true;
}
}
public static void main(String[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
//Get all methods of class
Method[] backaudomadMethoden = Backautomat.class.getMethods();
//Get first Method of class -> I know this one is static …Run Code Online (Sandbox Code Playgroud)