Wpis z mikrobloga

Podchwytliwe pytania na dziś:
Czy w Javie istnieje przekazywanie argumentów przez referencję?


http://stackoverflow.com/questions/40480/is-java-pass-by-reference-or-pass-by-value

The objects themselves are never passed to a method, but the objects are always in the heap and only a reference to the object is passed to the method.


Niby #java, ale większość języków wysokiego poziomu korzysta z tego. #programowanie #wyciagzestackoverflow
  • 35
Czy w Javie istnieje przekazywanie argumentów przez referencję?

Prawidłowa odpowiedź: nie.

only a reference to the object is passed to the method


@Ginden: Skoro tylko referencja jest przekazywana do metody to chyba istnieje metoda przekazywania argumentów przez referencje i jest nią po prostu zwykłe przekazanie argumentów?
@kradzionyLogin:
kontynuacja mojej powyższej wypowiedzi:

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())

A z kolei...
As much as is reasonably practical,