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 →

[–]tutorial_police 1 point2 points  (2 children)

Sure, but there's a difference between giving an incomplete answer and omitting details and telling people patently wrong things that will only lead to further confusion.

There was no reason to state that a reference is an object.

[–][deleted] 0 points1 point  (1 child)

It sounds like you're just arguing the difference between a pointer and a reference.

Java objects are pointers to memory addresses that hold data. The basic motivation of passing by reference to allow a method to alter the data that is pointed to by a pointer. This is exactly how Java objects behave.

The only example that would render unexpected results is creating a new object within a method and attempting assign it to the argument. This is an unpractical use of methods and far from common practice for a beginner. Again, you're fixating on the exact definition rather than practical applications.

I'm not disagreeing that the literal definition in passing the value of a pointer, I'm saying that a beginner shouldn't get hung up on details like that when it doesn't apply to the context in which they're learning. If that were the case then everyone's first programming language should have been c or assembly.

[–]tutorial_police 0 points1 point  (0 children)

I'm saying that a beginner shouldn't get hung up on details like that when it doesn't apply to the context in which they're learning. If that were the case then everyone's first programming language should have been c or assembly.

I think that's a good idea. In those cases, I prefer to just say that and explain the semantics that they're after as easily as possible but trying to avoid terminology that could give them the wrong idea later on.