I will try to answhere you step by step starting from your first question:
In Java, when an instance of a class, or object, is specified as a
parameter to a method, a copy of that object is being made
This is false, when you pass an object to a method Java never make a copy of it, as Davide Lorenzo said you are passing the reference to the object, not the object itself so if the method modify some of the attribute of the class you will have the value modified also outside from the method.
So we can answer to the second and third questions:
I know that functions in Java are pass-by-value, which would mean that
a copy of the object is being made?
No, Java doesn't make a copy. As Davide Lorenzo said you are passing a copy of the reference not a copy of the object.
But at the same time, if java objects are references and you pass a
reference, this is different to a copy of the actual data isn't it?
Yes, passing the reference is really different to passing a copy of the object.
I will clarify everything with an example.
Let's say we have the object Flower with the attribute color
public class Flower{
String color = "red";
}
enter code here
We can imagine the method setColor of AnotherObject
public void setColor(Flower flower, String color_string){
flower.color = color_string;
}
We can have the following situation
public static void main(String args[]){
Flower myFlower = new Flower();
AnotherObject otherObject = new AnotherObject();
otherObject.setColor(myFlower, "yellow");
System.out.println("The color of the flower is: "+myFlower.color);
}
The output of this code will be:
The color of the flower is yellow
This is why you are passing the reference of the object, not the object itself.
Now you can ask why Java is considered pass-by-value?
There is a very interesting discussion on this previous post about this, I would cite the best answer of it:
Java is always pass-by-value. Unfortunately, they decided to call
pointers references, thus confusing newbies. Because those references
are passed by value.
Last but not least note that only primitive type are not managed trough the references in Java, so passing an int is really different from passing an Integer, I suggest you to take a look on this post about the argument.