BigDaddyLoveHandle
Ok, I'm sorry to bother u. Just wondering pls, how come
System.out.println(Arrays.equals(aa, bb)); prints false? I mean from the code snippet u used as example for the deepEquals and equals.
The API says:
>if the two specified arrays of ints are equal to one another: I think so
>if both arrays contain the same number of elements: think so too
>all corresponding pairs of elements in the two arrays are equal: think so
>In other words, two arrays are equal if they contain the same elements in the same order
Here is the code again
import java.util.*;
public class DeepEqualsExample {
public static void main(String [] args){
int [] a = {1, 2};
int [] b = {1, 2};
int [][]aa = {a};
int [][] bb = {b};
System.out.println(Arrays.equals(aa, bb);
System.out.println(Arrays.deepEquals(aa, bb));
}
}
Thanx
[925 byte] By [
petitea] at [2007-11-27 11:51:42]

Try running this code instead and examine the differences:
int [] a = {1, 2};
int [] b = {1, 2};
int [][]aa = {a};
int [][] bb = {a};
System.out.println(Arrays.equals(aa, bb));
System.out.println(Arrays.deepEquals(aa, bb));
> Ok, I'm not like that guys. Not just the type. Just
> decided to address the message to him b'cos he posted
> the code. so pls can any one else help pls.
>
> Thanks in advance
I'm just messing with you no worries I'm stuck at work and it sucks gota have fun somehow ^.^ and i might have explained that wrong can't really tell any feedback?
Without additional checking, i suspect that this statement in the deepEquals method states why the results are different:
Unlike the equals(Object[],Object[]) method, this method is appropriate for use with nested arrays of arbitrary depth.
While there is no correspondingly opposite statement in the the equals method, it appears (from the above) that there could be a mention of the linitation.
> > > Sounds awfully volcanic to me.
> >
> > It's partly the leather chair.
>
> You ate a leather chair as well?
Probably needed the extra fiber after a meal like that.