Menu
Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Help comparing two arrays
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Knute Johnson" data-source="post: 619762"><p>Michelle:</p><p></p><p>You actually have the answer right there. What you have is an array</p><p>whose components are arrays of ints. Not an array of ints as required</p><p>by the method Arrays.equals(int[] a, int[] a2).</p><p></p><p>Change the last line of your program to:</p><p></p><p>System.out.println(java.util.Arrays.equals(i[1],j[1]));</p><p></p><p>and it will print true.</p></blockquote><p></p>
[QUOTE="Knute Johnson, post: 619762"] Michelle: You actually have the answer right there. What you have is an array whose components are arrays of ints. Not an array of ints as required by the method Arrays.equals(int[] a, int[] a2). Change the last line of your program to: System.out.println(java.util.Arrays.equals(i[1],j[1])); and it will print true. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Help comparing two arrays
Top