samedi 7 mars 2015

Is initialized non final static variables are thread safe?



Assume, I have a private non final static variable, and initialized in the static block, and it is not modified after initialization and has no methods to modify the variable. Is it threadsafe?



class Test
{
private static int value = 10;

public static int getValue()
{
return value;
}
}



Aucun commentaire:

Enregistrer un commentaire