Welcome Guest.

1Answers

Data structure programming! ! ! !

Asked by: Joyce 207 views IT July 23, 2019

If the elements of the two arrays list[1] and list[2] are equal, then list[1] and list[2] are considered identical. Write a method using the following method header, return true if list1 and list2 are identical; false otherwise.

public static boolean equals(int[] list1, int[] list2).

如:

int list1[] = {5, 2, 5, 6, 1, 6};

int list2[] = {5, 2, 5, 6, 1, 6};

int list3[] = {5, 2, 5, 6, 6, 1};

then equals(list1, list2 ) returns true; equals(list1, list3) returns false. (This question is done, ask for the answer!!!)

1 Answers

  1. +2Votes  

    This is an if condition, and then it can be traversed with for, hope to adopt

    Jeffrey Smith- July 23, 2019 |