Frage im Vorstellungsgespräch bei Veeva Systems

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

Antworten zu Vorstellungsgespräch

Anonym

10. Dez. 2012

Interviewer was wrong. You were correct.

Anonym

3. Jan. 2013

better say it's based on different situations

Anonym

8. Feb. 2012

You are correct. I checked it with a compiler.

2

Anonym

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.

Anonym

19. Juli 2012

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