Hi! In this code I print one message before and after executing the method obtenirInstanciaUnica, those 2 messages are actually displayed in the console, so far so good:
private void jbInit() throws Exception {
System.out.println("before obtenirInstanciaUnica");
gestor = GestorKlass.obtenirInstanciaUnica(Integer.parseInt(param.obtenirMaximMatrius()));
System.out.println("after obtenirInstanciaUnica");
Here's the method, in the constructor GestorKlass I try to display a message
public static synchronized GestorKlass obtenirInstanciaUnica(int maxMats){
System.out.println("I AM HEREEEEEEE");
if (instancia == null)
instancia = new GestorKlass(maxMats);
return instancia;
}
private GestorKlass(int max){
System.out.println("I AM CONSTRUCTING HERE");
maxMatrius = max;
numMatriusOcupades = 0;
matriusCarregades = new GestorMatriu[maxMatrius];
}
The question is WHY does not it write anything else to the console? it should show the message in the obtenirInstanciaUnica method first line, and also the message in the constructor, seems as if this method is not executed, but it is because It returns the gestor variable which is used all around the rest of the program and it works fine, I don't understand ..