I am quite confused with how Object works in Java since I run into this problem.
Let's say I have a function called checkDateValue (code looks like this)
private boolean checkDateValue(Date d1, String msg) {
    if (d1 == null) {
        msg = "d1 is null!";
        return false;
    }
    return true;
}
Here is the place I call this function:
String msg = null;
Date d1 = null;
if (!checkDateValue(d1, msg)) {
    system.println(msg); //msg is still null..... 
                         //what I need is the message generated in the function
}
As far as I know, if I put a customized Object (e.g.
myObj { private String msg;} 
) into a function, and we change the value of msg inside the function, when we get out of the function, the change of msg is kept. However, I think String is also considered as an Object in java. Why the change is not kept?
 
     
     
     
     
     
     
     
     
    