java - Why synchronize keyword not use with variable. Use only with method and synchronized block -
in java there synchronize keyword used avoid multiple thread access method or synchronize block @ time.
my question why not synchronize keyword used variables?. know java not allowed synchronized keyword variable. question why java not allowed synchronize keyword variable. problem if suppose use synchronize keyword variable?
the variable int, float etc.
e.g. synchronize int
variable in not stand on own. needs class have context. that's why lock on class or object , not on variable.
Comments
Post a Comment