Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to print a ArrayList?

807600Oct 3 2007 — edited Oct 3 2007
Hi, I am a newbie to Java, would someone pls help me:
I want to print a ArrayList expQueue, I used ListIterator as following:

ListIterator iter = expQueue.listIterator();
while (iter.hasNext()) {
System.out.print(iter.next()+",");
}
System.out.println();

the expected result should be: (id1, distance1), (id2,distance2), ...,
but the result likes: query.queuep@1a52fdf, query.queuep@120d62b, query.queuep@1362012.

what does it mean, and how can I get the expected results?

thanks in advance.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 31 2007
Added on Oct 3 2007
17 comments
531 views