关于java方法的一些东西(摘自JLS)

Ⅰ、Method Modifiers

Method modifiers include: Annotation, public, protected, private, abstarct, static, final synchronized, native, strictfp

A compile-time error occurs if a method declaration that contains the keyword abstract also contains any one of the keywords: private, static, final, native, strictfp or synchronized.

A compile-time error occurs if method declaration that contains the keyword native also contains strictfp.

At runtime, a machine-code generator of optimizer can "inline" the body of a final method.

Ⅱ、Overriding , Hiding

A compile-time error occurs if an instance method override a static method.

A comiple-time error occurs if a static method hides an instance method.

BUT it permissible for an instance variable to hide a static variable vice versa.

你可能感兴趣的:(java)