3 ms·
What about primitive variables, like "int"? If Java passed the variable reference (and not a copy), we should be able to modify it
by qw 16y ago
What about primitive variables, like "int"? If Java passed the variable reference (and not a copy), we should be able to modify it
- awj 16y agoYes, if it did that we would be able to modify it (and have those modifications reflected outside function scope). It doesn't, so we aren't. Primitives add complexity to many aspects of Java, calling semantics being one of them. I'd rather they'd went the route of forcing you to always use wrapped primitive types, but it's hard to fault the Java designers on that decision, especially when you consider the context of the time when it was made.