What is the Java equivalent of PHP var_dump?

后端 未结 11 635
北荒
北荒 2020-12-12 14:58

PHP has a var_dump() function which outputs the internal contents of an object, showing an object\'s type and content.

For example:

         


        
11条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-12 15:12

    I think something similar you could do is to create a simple method which prints the object you want to see. Something like this:

    public static void dd(Object obj) { System.out.println(obj); }
    

    It's not the same like var_dump(), but you can get an general idea of it, without the need to go to your debugger IDE.

提交回复
热议问题