Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for "===" equivalent in Java

Current License: CC BY-SA 4.0

35 events
when toggle format what by license comment
Apr 17, 2023 at 8:07 comment added Cees Timmerman TL;DR: === in Java is .equals()
Jul 5, 2019 at 3:54 audit First posts
Jul 5, 2019 at 4:05
Jul 5, 2019 at 2:29 audit First posts
Jul 5, 2019 at 3:35
Jun 26, 2019 at 17:36 audit First posts
Jun 26, 2019 at 17:47
Jun 26, 2019 at 14:17 audit First posts
Jun 26, 2019 at 14:29
Jun 25, 2019 at 17:56 audit First posts
Jun 25, 2019 at 17:56
Jun 24, 2019 at 21:01 history bounty awarded Madara's Ghost
Jun 24, 2019 at 19:30 comment added M A @Nexevis var in Java 10 is pure syntactic sugar to avoid writing the declaration type of the variable when it can be inferred from the created instance. The language is still strongly-typed.
Jun 21, 2019 at 1:16 audit First posts
Jun 21, 2019 at 1:17
Jun 20, 2019 at 18:30 vote accept JavaCakes
Jun 20, 2019 at 18:08 history edited lealceldeiro CC BY-SA 4.0
added 34 characters in body
Jun 20, 2019 at 17:52 history edited lealceldeiro CC BY-SA 4.0
Add useful info about how to override equals and hashCode methods.
Jun 20, 2019 at 17:43 comment added lealceldeiro The try-catch won't be needed. If you use == and those both things can not be compared, the compiler will tell you at compile time, otherwise it will compile and return true or false depending on their reference in memory. If you use equals the behavior is the same as == by default, but you can override it for any class you own and change how it behaves, being able this way, to return true or false also depending on the content of the object (its logical fields), and not only its reference in memory. Careful here on how you implement the equals method There are rules to do it
Jun 20, 2019 at 17:40 comment added Ivar @JavaCakes They write the same thing for me (1, 2).
Jun 20, 2019 at 17:34 comment added JavaCakes Okay so if I want to compare things of different types I need to do it manually or use try/catch
Jun 20, 2019 at 17:28 comment added JavaCakes @Ivar not it intirely true, as document.write(parseInt(10.0) and document.write(10.0) will write different things
Jun 20, 2019 at 16:16 history edited lealceldeiro CC BY-SA 4.0
Add info
Jun 20, 2019 at 14:39 history edited lealceldeiro CC BY-SA 4.0
add info
Jun 20, 2019 at 14:31 history rollback lealceldeiro
Rollback to Revision 8
Jun 20, 2019 at 14:26 history edited lealceldeiro CC BY-SA 4.0
deleted 38 characters in body
Jun 20, 2019 at 14:22 comment added lealceldeiro Amend to my last comment: The compiler (not the ==) checks for reference type (thus the error at compile time)
Jun 20, 2019 at 13:25 history edited lealceldeiro CC BY-SA 4.0
deleted 3 characters in body
Jun 20, 2019 at 13:00 history edited lealceldeiro CC BY-SA 4.0
deleted 20 characters in body
Jun 20, 2019 at 12:50 comment added Felix @lealceldeiro == only checks for reference. If it's the same reference it can't be of another type
Jun 20, 2019 at 12:50 history edited lealceldeiro CC BY-SA 4.0
Add info
Jun 20, 2019 at 12:42 history edited lealceldeiro CC BY-SA 4.0
Add info
Jun 20, 2019 at 12:32 history edited lealceldeiro CC BY-SA 4.0
added 115 characters in body
Jun 20, 2019 at 12:26 comment added Ivar @lealceldeiro JavaScript doesn't have doubles or integers. Just "Numbers" which are essentially doubles. So 10 and 10.0 are both the same.
Jun 20, 2019 at 12:18 history edited lealceldeiro CC BY-SA 4.0
Leave just parent link
Jun 20, 2019 at 12:17 comment added Nexevis var i = "10"; var d = 10.0; console.log(i == d); is true in JS even, just tried it.
Jun 20, 2019 at 12:16 comment added lealceldeiro @CarlosHeuberger In JS: var i = 10; var d = 10.0; console.log(i == d); /*true*/ console.log(i === d); /*true*/
Jun 20, 2019 at 12:09 comment added lealceldeiro @Nexevis, Carlos Heuberger is right. It's the same with Java 10. Here: docs.oracle.com/javase/specs/jls/se10/html/…
Jun 20, 2019 at 12:04 comment added Nexevis What about in Java 10 where you can now use var?
Jun 20, 2019 at 11:57 history edited lealceldeiro CC BY-SA 4.0
added 127 characters in body
Jun 20, 2019 at 11:52 history answered lealceldeiro CC BY-SA 4.0
toggle format

AltStyle によって変換されたページ (->オリジナル) /