Why I cannot override method wait() in Java? -


i find method wait() in class object.
final means method cannot overriden.
ideas why it's final?

@flavio - it's question.

the reason you can't override it, of course, designers made "final".

a couple of potential reasons decision:

  • you don't want people mess semantics of fundamental operation on fundamental class (class "object").

  • since it's "final", compilers can optimize performance (save few cycles) in-lining "wait()"

  • "final" increases security of java object model preventing malicious code exploiting "wait()".


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

objective c - Ownership modifiers with manual reference counting -

python 3.x - Mapping specific letters onto a list of words -