betweenGo

Printing out an array

by Frank Kim on Mar.28, 2007, under Java SE

When printing out an array if you simply do a toString on the array you will get a “fairly useless result such as [C@16f0472". Consider using Arrays.asList followed by toString but Arrays.toString is definitely more efficient and is available as of JDK 1.5.0.

This method is useful when you want to report on the values of an JDK 1.5 enum since the values method returns an array.

The quote is from a FindBugs report.

  • Share/Bookmark

Related posts:

  1. Save the Output in a Shell Script Array
  2. How to Set an Array Property in an ATG Form
  3. Data Structures Interview Questions
  4. Find a class’s runtime origin

:

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!