Sollicitatievraag bij Veeva Systems

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

Antwoorden op sollicitatievragen

Anoniem

10 dec 2012

Interviewer was wrong. You were correct.

Anoniem

3 jan 2013

better say it's based on different situations

Anoniem

6 feb 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.

Anoniem

8 feb 2012

You are correct. I checked it with a compiler.

2

Anoniem

19 jul 2012

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