2 ms·
Actually, Java only has pass-by-value, even for reference types. (The same way as C does). People really misuse/misunderstand this term: Java objects are passe
by gf000 4mo ago
Actually, Java only has pass-by-value, even for reference types. (The same way as C does).
People really misuse/misunderstand this term: Java objects are passed by their pointers ("references") being copied.
The alternative is pass by reference, which is done by e.g. c++, rust, who actually have references (Java doesn't). A good litmus test is whether you can write a swap method that actually changes your local variables.
- steveklabnik 4mo agoRust is also “pass reference by value,” not pass by reference.
- deleted 4mo ago[deleted]