It depends what exactly you mean by input, specifically whether you mean a variable that appears as an argument at a call site, e.g., x
in:
Object x = ...;
someMethod( x );
or you're talking about the actual object that the called function will see, e.g., the actual Object instance in:
someMethod( new Object() );
The value of variables (i.e., what object they refer to) won't change, but you can still do things to the objects that you get. E.g.,
void appendX( StringBuilder sb ) {
sb.append('x');
}
void foo() {
StringBuilder builder = ...
appendX( builder );
builder.toString(); // will contain 'x' because you worked with the object that
// is the value of the variable `builder`. When appendX was
// was invoked, the value of its variable `sb` was the same
// object that is the value of foo's `builder`. Without
// changing what value the variable `builder` refers to, we
// did "change" the object (i.e., we appended 'x').
}
However, updating the reference in a method doesn't change any references outside of the method. From within a method, you can't, by assigning to one of the parameters of the method, change what object a variable outside the method refers to. E.g.:
void setNull( StringBuilder sb ) {
sb = null;
}
void foo() {
StringBuilder builder = ...
appendX( builder );
builder == null; // false, because the value of the variable `builder` is still the
// same object that it was before. Setting variable `sb` in setNull
// to null doesn't affect the variable `builder`. The variables are
// just a name so that you can refer to an value. The only way to
// what value a variable refers to is with an assignment.
}