Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Weird array output

  1. #1
    Army is offline Senior Member
    Join Date
    Jan 2012
    Posts
    147
    Rep Power
    0

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    6

    Default Re: Weird array output

    You have to iterate over the array and print each element instead to pass the array to the println method! another way would be to use System.out.println(Arrays.toString(b))
    examples can be found in the internet :D (for example: In Java, how can I print an array of ints? - Yahoo! Answers)

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default Re: Weird array output

    Just adding more.

    For arrays within arrays you can use Arrays.deepToString(arr). And also toString() calls on each object in an array of Object[] version.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,452
    Rep Power
    20

    Default Re: Weird array output

    Oh, and there's nothing weird about the result you reported. It's expected.

    db
    Eranga likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. System.out.println not printing, weird output
    By KonchShell in forum New To Java
    Replies: 9
    Last Post: 03-16-2011, 12:50 PM
  2. weird output relate to socket programming
    By nanshaguo in forum Networking
    Replies: 1
    Last Post: 03-14-2011, 05:37 PM
  3. Weird output
    By gandalf5166 in forum New To Java
    Replies: 2
    Last Post: 02-28-2010, 10:17 PM
  4. Seriously weird output
    By gandalf5166 in forum Java Applets
    Replies: 4
    Last Post: 02-27-2010, 05:16 AM
  5. Weird data output
    By Shaolin in forum New To Java
    Replies: 12
    Last Post: 12-11-2007, 05:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •