== and equals

Because I make a small mistake when writing code I will make an article as a memorandum as a commandment.

The following mistake in checking the if statement of a String type variable

<✕>
if(name == "minato"){
···processing
}

<〇>
if(name.equals("minato")){
···processing
}

Recommended Posts

== and equals
[Java] Difference between == and equals
[Java] HashCode and equals overrides
Difference between == operator and equals method
About the equals () and hashcode () methods
How to use equality and equality (how to use equals)
[Java beginner] == operator and equals method
Understanding equals and hashCode in Java
Classes and instances
getAttribute () and unboxing
Class and model
Rails and FormData
rescue and rescue_from
LinkedList and ArrayList
[Member and collection]
Date and time
try-with-resources and AutoCloseable
Streams and parallel streams
JavaFX and HiDPI
JAVA_HOME and Path
interface and abstract
switch and EnumMap
Functions and methods
Apache and tomcat
variable and method
Java and JavaScript
Date () and Calendar ()
XXE and Java
subscribeOn and observeOn
jacl and jsr223
"hoge hoge" .equals ("hoge hoge") // false
Ruby and Gem
scheme and jsr223
Inheritance and interface.
Overriding and Overloading
[Java] About Objects.equals () and Review of String comparisons (== and equals)