so someone had mentioned to me about an operator like the "==" in java but they said instead it was "dot equals" or ".=" I am assuming... I have looked up documentation on all the java operators but can't find this one anywhere, even went to the official oracle documentation list of operators and searched for it and couldn't find it... is this really a thing in Java? if so what does it do?
Asked
Active
Viewed 50 times
0
-
4There is the method `equals`, as in `x.equals(y)`. Maybe that's what you're looking for. – khelwood Nov 10 '17 at 12:30
-
https://docs.oracle.com/javase/7/docs/api/java/lang/Object.htmlhttps://docs.oracle.com/javase/7/docs/api/java/lang/Object.html – Aman Nov 10 '17 at 12:32
2 Answers
0
equals method is defined is Object class
https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html
o.equals(p)

Aman
- 806
- 2
- 12
- 38
-
ahhh ... yeah I know about .equals... silly ... i thought they meant literally ".=" whoops...guess this was a pointless question and duplicate then – Chase Nov 10 '17 at 12:33
-
haha no you got it wrong then.. no problem they really meant .equals but read the concept behind using it.. it's really amazing – Aman Nov 10 '17 at 12:35
-
== -> is a reference comparison, i.e. both objects point to the same memory location... while .equals compare the value of both object – Aman Nov 10 '17 at 12:36
0
They might have meant .equals() instead of '.=' since '.=' ain't a thing The difference between == and .equals() is that objects can override .equals() to suit there purpose and == just checks it

Lars Dormans
- 171
- 1
- 13