List< String > strings = new LinkedList< String >(); strings.add("one"); strings.add("two"); strings.add("three"); System.out.printf( "List< String >.toString()\n%s\n\n" ,strings.toString()); System.out.printf( "List< String >.toArray().toString()\n%s\n\n" ,strings.toArray().toString()); System.out.printf( "Arrays.toString(List< String >.toArray())\n%s\n\n" ,Arrays.toString(strings.toArray()));
The output looks like this:
List< String >.toString() [one, two, three] List< String >.toArray().toString() [Ljava.lang.Object;@1ea87e7b Arrays.toString(List< String >.toArray()) [one, two, three]
Enjoy!
No comments:
Post a Comment