Java how to print all local variables?

后端 未结 6 2042
长情又很酷
长情又很酷 2021-01-12 04:25

I have a method and want to examine variables inside it without debugging - is it possible in Java?

I do not want to write tons of code like:

Syste         


        
6条回答
  •  我在风中等你
    2021-01-12 04:35

    You can use System.out.println to print out variables. Example:

    int i = 42;
    System.out.println("i:" + i);
    

提交回复
热议问题