class level private variables thread safe?

Hi I would like to know if the class level private variables are thread safe.if someone could throw more light on that....Thanks,Anil
[161 byte] By [thunderimpulsea] at [2007-10-2 2:08:10]
# 1
Not automatically, no.
-Kayaman-a at 2007-7-15 19:49:37 > top of Java-index,Java Essentials,Java Programming...
# 2

The question you should ask yourself is: can they be modified (nearly) at the same time by different threads. If yes, they are not thread safe.

While private

shields again the arbitrary stranger messing with your variables directly, this arbitrary stranger may be using public methods of that class to cause changes.

Harald.

pifpafpufa at 2007-7-15 19:49:37 > top of Java-index,Java Essentials,Java Programming...
# 3

> The question you should ask yourself is: can they be

> modified (nearly) at the same time by different

> threads. If yes, they are not thread safe.

>

> While private

shields again the

> arbitrary stranger messing with your variables

> directly, this arbitrary stranger may be using public

> methods of that class to cause changes.

>

>Harald.

I hate it when arbitrary stragers mess with my privates.

MrPicklesa at 2007-7-15 19:49:37 > top of Java-index,Java Essentials,Java Programming...
# 4
s/stragers/strangers
MrPicklesa at 2007-7-15 19:49:37 > top of Java-index,Java Essentials,Java Programming...