| Author |
Inquisition Question
|
Chandana Garlapati
Ranch Hand
Joined: Jul 06, 2009
Posts: 97
|
|
why the above code prints false???
|
 |
Siva Masilamani
Ranch Hand
Joined: Sep 19, 2008
Posts: 377
|
|
Because int[] does not override the equals method.
By default equals method returns true if both the reference are pointing to the same object whcih is not in your case.
To compare arrays use Arrays.equals(arr,arr) method.
|
SCJP 6,SCWCD 5,SCBCD 5
Failure is not an option.
|
 |
Chandana Garlapati
Ranch Hand
Joined: Jul 06, 2009
Posts: 97
|
|
|
Thanks Siva.
|
 |
 |
|
|
subject: Inquisition Question
|
|
|