For example I have a class like this:
public class StaticObjectReference{
private static StaticObjectReference instance;
private Vector queue;
public static StaticObjectReference getInstance(){
if(instance == null){
instance = new StaticObjectReference();
}
return instance;
}
public Vector getQueue(){
queue = new Vector();
return queue;
}
}
And these next two classes called the StaticObjectReference
class.
public class CallerOne{
Vector queue1;
public void callObjectInstance1(){
queue1 = StaticObjectReference.getInstance().getQueue();
}
}
class CallerTwo{
Vector queue2;
public void callObjectInstance2(){
queue2 = StaticObjectReference.getInstance().getQueue();
}
}
Is the queue1
in the class CallerOne the same instance queue2
in the class CallerTwo?