Hi everyone,
I am unclear when initializing static variables the following way:
public class Client{
private static Resource resource = null;
public Client(argument){
resource = new Resource(argument);
}
}
Let's say that multiple Client objects are instantiated. My question is what happens during the "resource" instantiation - which is part of the Client instantiation, when:
a) "argument" is always the same (i.e. a constant) across all Client instantiations, and
b) "argument" is different with every Client instantiation.
Now I believe for a) "resource" object will be unique and common for all Client instantiations,
but for b) I have doubts as to if "resource" will be unique or a new "resource" object will be created with every new Client instantiation.
Thanks much in advance for clearing this up for me.
Regards.