Domanda di colloquio di Veeva Systems

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

Risposte di colloquio

Anonimo

10 dic 2012

Interviewer was wrong. You were correct.

Anonimo

3 gen 2013

better say it's based on different situations

Anonimo

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.

Anonimo

8 feb 2012

You are correct. I checked it with a compiler.

2

Anonimo

19 lug 2012

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