Rahul.p Kumar wrote:when we close() the connection (layman term), then what exactly it does with that connection object or driver class
You don't know and you don't care.
Its not for a programmer to look inside a JDBC driver and determine how/what it does. The only thing you need to know is that any time you get a connection you *must* close it (hence the finally block) else you may leave that connection open in your application and eventually run out of available connections. This isn't c++ where there's an object deconstructor, setting a object to null really doesn't do anything special except possibly lose any reference to the connection you have yet to close.
After a connection is closed, it is still a valid object. You can set it to null if you'd like but there's rarely a reason to since it should go away anyway after the function finishes. Forget about what happens inside of Connection.close() since it can vary among JDBC drivers. As long as it properly closes the active connection with the database (which all stable ones will do), you don't care about the details. That's why its a factory/blackbox
pattern.