Hi:
I have a basic question on when memory is allocated for an object and if that memory is "shared" between the class that instantiates it and the class itself. I am using "class" and "objects" interchangeably here.
In the following example, do we have one memory allocation of Statement st or two memory allocations (myServlet's and DBConnect)?
myServlet:
DBConnection dbconnect = new DBConnection();
Statement st = dbconnect.setConnection();
Java Class:
public class DBConnect implements Serializable {
private Connection conn = null;
private Statement st = null;
public DBConnection() {
}
public Statement setConnection() {
<other statements>
conn = ds.getConnection(...);
st = conn.createStatement();
return st;
}
}
Thanks!
[ January 30, 2004: Message edited by: K Nally ]
[ January 30, 2004: Message edited by: K Nally ]
[ January 30, 2004: Message edited by: K Nally ]