Pergunta de entrevista da empresa Veeva Systems

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

Respostas da entrevista

Sigiloso

10 de dez. de 2012

Interviewer was wrong. You were correct.

Sigiloso

3 de jan. de 2013

better say it's based on different situations

Sigiloso

6 de fev. de 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.

Sigiloso

8 de fev. de 2012

You are correct. I checked it with a compiler.

2

Sigiloso

19 de jul. de 2012

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