I am recently wondering how functions like the InputStream int read(byte[] b) method are working. I know that Java is always passing method parameters by value, and not by reference.
Knowing this, I don't understand how an empty byte-array can contain values after passing it to the read-method (assuming there were bytes to read in the InputStream). From all I know, only the value passed to the read-method will be touched internally and the only output should be the number of read bytes (the integer return value). But still the byte-array somehow fills.
How is this actually done?