mercredi 29 avril 2020

Java count appearences of variable/method in the code

I want to find out how often one specific variable appears or how often one specific method is called in the code and use this number in the same code. For Example:

public static main(String[] args){
   int a = 0;
   System.out.println(mysticMethod());
   int a++;
   int a = 3;
}

The mysticMethod() should now count how often the variable a appears in this class or the main method. Is there any way to do so?

I am grateful for all answers!





Aucun commentaire:

Enregistrer un commentaire