H
H
hellcaster2019-02-22 12:42:03
Java
hellcaster, 2019-02-22 12:42:03

Why "" != "" ??

5c6fc2f7d2efd360203743.png5c6fc3017024f367990732.png
The pictures clearly show that song.get(0) == "", but when it comes to , it returns false and goes to else (if changed to , it returns true). What am I doing wrong? Why "" != "" ?? if (song.get(0) == "")if (song.get(0) != "")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Strannyk, 2019-02-22
@web_Developer_Victor

In Java, strings are objects, and objects are only equal if they are the same object. To compare strings, use the equals method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question