Pergunta de entrevista da empresa Apple

Is Java pass-by-value or pass-by-reference?

Respostas da entrevista

Sigiloso

26 de fev. de 2016

Actually, everything in Java is pass-by-value. Objects are not passed by reference, but rather, object references are passed by value. In a language like Java that has no such thing as a dereference, this is a subtle but important distinction. I'm usually wary in interviews when the interviewer tries to push these sorts of subtle "gotchas" in an interview when really a coding example will show whether or not you understand the underlying concept rather than the nitpicky vocabulary.

6

Sigiloso

9 de jan. de 2016

Scalars are passed by value while objects are passed by reference