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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -