The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
October 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Re: Using the list method in the File class

Posted by Brian Sanders on October 09, 2001 at 4:50 PM

Like I said, when I print b, I get some gobbledygook which shouldn't happen.

Your gobbledygook may be just what is expected. Given this example,

String[] s = { "foo", "bar", "baz" };

the value that is printed to the console is similar to this:
[Ljava.lang.String;@136228. And this is entirely appropriate. This indicates that the value being printed is a one-dimensional String array at a particular memory address.

If you want to print out the values in an array, you must iterate:

for (int i=0; i < s.length; i++)


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us