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

Comparision

 
Ramgopal Reddy
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference b/w == and .equals

at what sistuations we use these two.


Someware i hears one is deepcomparison and other one is shallow comparison!

what r that words.
 
Tony Morris
Ranch Hand
Posts: 1608
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The former is called the reference equality operator when both operands are a reference type (perhaps implicitly through autoboxing) - it compares the value of a reference to some other reference.

The latter is a method that is regularly used throughout the J2SE API Specification to determine "value equality" between two object instances. For example, in the Java collections API.

It might help to learn the difference between an object and an object reference:
http://jqa.tmorris.net/GetQAndA.action?qids=75&showAnswers=true
 
Peter Chase
Ranch Hand
Posts: 1970
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is so not an advanced question! It's also an FAQ, isn't it?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter Chase:
This is so not an advanced question!


Indeed. Let's move this to Java in General (Beginner.)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic