Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I stumbled upon this questionquestion and a couple of other along the same lines.

While we know creation of enum is thread safe and enums are by birth singletons .

It kind of confuses me that why would any one want to have a synchronized method with in an enum. Yes I am fully aware that methods in an enum are not thread safe but then what?

They must not try to change the state of an enum any way . If we are not concerned about change of state of an enum then why would we ever like a method in an enum to be thread safe.

I stumbled upon this question and a couple of other along the same lines.

While we know creation of enum is thread safe and enums are by birth singletons .

It kind of confuses me that why would any one want to have a synchronized method with in an enum. Yes I am fully aware that methods in an enum are not thread safe but then what?

They must not try to change the state of an enum any way . If we are not concerned about change of state of an enum then why would we ever like a method in an enum to be thread safe.

I stumbled upon this question and a couple of other along the same lines.

While we know creation of enum is thread safe and enums are by birth singletons .

It kind of confuses me that why would any one want to have a synchronized method with in an enum. Yes I am fully aware that methods in an enum are not thread safe but then what?

They must not try to change the state of an enum any way . If we are not concerned about change of state of an enum then why would we ever like a method in an enum to be thread safe.

Tweeted twitter.com/#!/StackProgrammer/status/205844431318953986
Source Link
Shahzeb
  • 310
  • 1
  • 4
  • 7

Why would one ever want to use a synchronized method in Enum?

I stumbled upon this question and a couple of other along the same lines.

While we know creation of enum is thread safe and enums are by birth singletons .

It kind of confuses me that why would any one want to have a synchronized method with in an enum. Yes I am fully aware that methods in an enum are not thread safe but then what?

They must not try to change the state of an enum any way . If we are not concerned about change of state of an enum then why would we ever like a method in an enum to be thread safe.