File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inquisition Question

 
Chandana Garlapati
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


why the above code prints false???
 
Siva Masilamani
Ranch Hand
Posts: 385
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chandana Garlapati
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Siva.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic