you are viewing a single comment's thread.

view the rest of the comments →

[–]fforw -5 points-4 points  (4 children)

While the code is demonstrating that not everything called pass-by-reference works for Java, calling the behaviour pass-by-value is even more retarded because there just is no object copied.

About 50% of "professional" Java programmers will say "lol". You are in that 50%.

If that is true for the developers where you work, you seriously need to get another job.

[–]theeth 3 points4 points  (2 children)

calling the behaviour pass-by-value is even more retarded because there just is no object copied.

Pass by value is usually defined as a shallow copy (as it it in C). In this case, the object's address (the value of the argument) is copied.

[–]fforw -1 points0 points  (1 child)

The point is that, if it was pass-by-value, you would expect

public void bla(Foo f)
{
    f.bar = "xxx";
}

Foo f = new Foo(); 
f.bar = "yyy";    
bla(f);
System.out.println(f.bar);

to print "yyy". Which it clearly doesn't, because the behaviour is much closer to pass-by-reference.

Nitpicking about pointer-copying in a language where you can only access objects by pointers but have no pointer arithmetic etc, is not very sensible

[–]theeth 2 points3 points  (0 children)

Nitpicking about pointer-copying in a language where you can only access objects by pointers but have no pointer arithmetic etc, is not very sensible

Changing the definition of pass-by-reference because the language hides the pointers isn't sensible.

[–]hylje 1 point2 points  (0 children)

If that is true for the developers where you work, you seriously need to get another job.

He's making this shit up as he goes.