Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8448661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:29:20+00:00 2026-06-10T10:29:20+00:00

Can you explain why this code int[] test={0,0,0,0,0}; System.out.println(test); prints something like [I@42e816 (perhaps

  • 0

Can you explain why this code

int[] test={0,0,0,0,0};
System.out.println(test);

prints something like [I@42e816 (perhaps memory address) but this code

 Stack<Integer> stack = new Stack<Integer>();
 stack.push(1);
 stack.push(3);
 stack.push(5);
 stack.push(2);
 stack.push(4);
 System.out.println(stack);

prints “[1, 3, 5, 2, 4]”? What’s the difference?

If Stacks derive from Vectors and Vectors from arrays, what’s the cause of this different behavior?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:29:22+00:00Added an answer on June 10, 2026 at 10:29 am

    The collections have a well defined toString() method, but arrays were forgotten about IMHO and use the default Object.toString() along with lots of other default method from Object which are not very useful either. You need to call one of the many helper classes were added later to make arrays more useful.

    System.out.println(Arrays.toString(test));
    

    The hexidecimal is the default hashCode() of the object rather than an address. It might not be unique and even if the array moves around the memory, this number won’t change.

    For helper classes for arrays

    java.lang.reflect.Array
    java.util.Arrays
    java.lang.System.arraycopy(); // one method
    

    for extra ones

    org.apache.commons.lang.ArrayUtils
    org.uispec4j.utils.ArrayUtil
    toxi.util.datatypes.ArrayUtil
    net.sf.javaml.utils.ArrayUtils
    com.liferay.portal.kernel.util.ArrayUtil
    

    and many more.

    It not the case that arrays shouldn’t have their own methods but rather there is too many to choose from. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can you explain to me the output of this Java code? int a=5,i; i=++a
Can someone explain this behaviour? test.c: #include <stdio.h> int main(void) { printf(%d, %d\n, (int)
Can anyone explain this code to me? Whats the meaning and how to use
Can anyone explain why this code: {% form_theme form _self %} {% block avo_gallery_upload_widget
Can anyone explain why this code with the given routes returns the first route?
I am newbie to jQuery, can someone explain what this code does: $(#currency form).submit(function(e)
Can anybody explain what does JdClient is in this code: public JdClient client =
Can someone explain to me what the bolded portions of this code are doing?
This code is not compilable. I can't find why in standard. Can someone explain?
anyone can explain me, why this parts of code are acting differently? while((c =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.