In the closeConnection() method, the dbConnection variable does indeed receive the value "null". The reason the conn variable in the main() method does not become null, is because in
Java parameters are always passed by value. That is, the value of the variable conn (which is the address of the Connection object) is copied into the parameter variable dbConnection. Note that in closeConnection(), because dbConnection now contains the same address as conn, they refer to the same Connection object in the heap. dbConnection then receives the value null. However, because the pass-by-value parameter passing scheme is used, this value is NOT copied back to conn. conn still refers to the Connection object, which still exists in the heap, although it is closed and may therefore not be used anymore. Note that, as long as the Connection is closed, it doesn't matter that it is still in the heap - the space that it occupies will be freed by the Java runtime garbage collector eventually.
I suggest that you read up about parameter passing modes to be able to understand this concept better. For instance, have a look at
http://pages.cs.wisc.edu/~hasti/cs368/CppTutorial/NOTES/PARAMS.html.
Finally, whenever you create about any kind of connection, you must ensure that it will always eventually be closed. This should be done by using a finally-block.
Note that in your main() method, if an exception is thrown between lines 43 and 45, the Connection will never be closed.
The correct version of your main() method is: