=====suppose such a method:
public static void openFile(String fileName, PrintWriter stream) throws FileNotFoundException
{
stream = new PrintWriter(fileName);
}
=====then we want to use it this way:
PrintWriter toFile = null;
try
{
openFile("data.txt", toFile);
}
*****After this code is executed, the value of toFile is still null. The file that was opened in the method openFile went away when the method ended. The problem has to do with how Java handles arguments of a class type.
"These arguments are passed to the method as memory addresses that cannot be changed. The state of the object at the memory address normally can be changed, but the memory address itself cannot be changed"!