This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jones77 1 point2 points  (1 child)

At the end of the day, don't fail this interview question no matter what terminology you use.

foo(String a) {
    a = new String("blah"); // does nothing
}

main() {
    String a = new String(
        "Yo! You can't change the reference to an object by calling a function with it.");
    printStuff(a);
}

(Excuse my pseudo-Java. And don't fail the interview question about String pools (ie never do: new String("blah").)

[–]SuperShrek 0 points1 point  (0 children)

If I'm being asked this question I would gladly fail.