title: Why do I get garbage values when print arrays in Java?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/409784/simplest-way-to-print-an-array-in-java">Simplest way to print an array in Java</a>  </p>
  </blockquote>
  
  
  
  <p>How do I even print arrays? I'm trying to experiment on some methods and all I keep on getting are garbage values. I tried to import the Arrays library - still didn't work.</p>
  
  <pre><code>    int []x = {1, 2, 3, 4, 5};
      int []y;
      y = x.clone();
      System.out.println(x);
      System.out.println(y);
  </code></pre>