Question d’entretien chez Veeva Systems

String foo = "abc"; String foo1 = "abc" what does (foo == foo1) evaluate to?

Réponses aux questions d'entretien

Utilisateur anonyme

10 déc. 2012

Interviewer was wrong. You were correct.

Utilisateur anonyme

3 janv. 2013

better say it's based on different situations

Utilisateur anonyme

6 févr. 2012

I thought it was true because hey would be referencing the same object in memory because of String interning. Told the answer was false.

Utilisateur anonyme

8 févr. 2012

You are correct. I checked it with a compiler.

2

Utilisateur anonyme

19 juil. 2012

This situation is same as new String("abc") == new String("abc") rather than "abc"=="abc". so you was wrong.