Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: print_r?

last time I asked how to populate a data structure here. Now I would like to know if there's something in Java, like the print_r I use in PHP, to represent what I have populated in the Maps and lists without having to do my own algorithm.

Any ideas?

like image 436
Jean Paul Galea Avatar asked Sep 29 '08 10:09

Jean Paul Galea


People also ask

What is use of Print_r () function?

print_r(variable, isStore) It is a built-in function in print_r in PHP that is used to print or display the contents of a variable. It essentially prints human-readable data about a variable. The value of the variable will be printed if it is a string, integer, or float.

Where does Print_r output?

The api. php file is in C:\Program Files\xampp\htdocs\project\app\api\api.

What is Print_r in Python?

Python-printr is a module that allows to emulate the print_r() function of PHP by printing the objects properties of a class instance and its internal structure. If you need to use printr() function for list, tuples and dicts, please, don't use printr() function.

How can we display information of a variable and readable by a human with PHP?

print_r() displays information about a variable in a way that's readable by humans. print_r(), var_dump() and var_export() will also show protected and private properties of objects.


1 Answers

Calling toString on the collection should return a string containing all the elements string representations.

This won't work with built-in arrays though, as they don't have a toString override and will just give you a memory address.

like image 183
workmad3 Avatar answered Sep 20 '22 19:09

workmad3