File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Inquisition Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inquisition Question" Watch "Inquisition Question" New topic
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: 385
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inquisition Question
 
Similar Threads
equals() doubt
arrays equals() confusion
Doubt in Array Declaration
Array Help
Array/Constructor Problem