logo Practice-It logo

equals

Language/Type: Java arrays
Author: Marty Stepp (on 2010/12/28)

Write a method named equals that accepts a pair of arrays of integers as parameters and returns true if the arrays contain the same elements in the same order. If the arrays are not the same length, your method should return false.

For example, if the following arrays are declared:

int[] a1 = {10, 20, 30, 40, 50, 60};
int[] a2 = {10, 20, 30, 40, 50, 60};
int[] a3 = {20, 3, 50, 10, 68};

The call equals(a1, a2) returns true but the call equals(a1, a3) returns false.

Type your solution here:


This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.