Arrays element Equals

Hi

I can make equals of 2 array list.
if (Arrays.equals(data1, data2)) {

but how can i make equal of element in the array.

Write a method called contains that accepts two arrays of integers a1 and a2 as parameters and that returns a
boolean value indicating whether or not the sequence of elements in a2 appears in a1 (true for yes, false for no).
The sequence must appear consecutively and in the same order. For example, consider the following arrays:
int[] list1 = {1, 6, 2, 1, 4, 1, 2, 1, 8};
int[] list2 = {1, 2, 1};
The call of contains(list1, list2) should return true because the sequence of values in list2 {1, 2, 1} is contained
in list1 starting at index 5. If list2 had stored the values {2, 1, 2}, the call of contains(list1, list2)
would return false. Any two lists with identical elements are considered to contain each other. Every array contains
the empty array, and the empty array does not contain any arrays other than the empty array itself.

Re: Arrays element Equals

please help..

i dont [inappropriate language deleted] understand this. i wasted now 5 hours on this quastion. and now i face 4 another quastion want me to compare a list of element with another list of array element.

Write a method called allLess that accepts two arrays of integers and returns true if each element in the first array
is less than the element at the same index in the second array. Your method should return false if the arrays are not
the same length

please understadn this. i do do do do not not not not have experience in java. i dont know whatt to useeeeeeee. and howwww to compare first element with another arrays element.

give me solution and i will solve all other quastion:
be fair.

1. i know i should use boolean.
2. i know i need loops
3. how the [inappropriate language deleted] can i make 2 loops goes indside 2 arrays . catch first element. then compare with another array's element.

Re: Arrays element Equals

Given an array, how do you access an element of that array?
This is the way: theArrayName[theIndex]
Now what if there is another array that you want to compare the elements of one array against the elements of the other?
How would you code a comparison of values if the values to be compared were in variables? Say abc vs def?
if( abc < def)
The elements of an array are the same as variables and can be used the same way as a variable:
if(anarray[indexToArray] < def)

Re: Arrays element Equals

Originally Posted by Norm

Given an array, how do you access an element of that array?
This is the way: theArrayName[theIndex]
Now what if there is another array that you want to compare the elements of one array against the elements of the other?
How would you code a comparison of values if the values to be compared were in variables? Say abc vs def?
if( abc < def)
The elements of an array are the same as variables and can be used the same way as a variable:
if(anarray[indexToArray] < def)

Re: Arrays element Equals

Originally Posted by zonic

... code deleted ...

Zonic, please don't spoon-feed answers here. It's a lazy way to answer as it's easy to create the codes, much easier than trying to explain to the poster how to fix it themselves, and the posters learn nothing but how to beg for code.