关于java方法的一些东西(摘自JLS)
2011-07-24 20:14
591 查看
Ⅰ、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.
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中关于时间跟日期的一些常用方法
- 关于java线程的一些东西
- 关于JAVA垃圾收集器与类的finalize()方法的一些总结
- java 中关于日历的一些方法
- 关于JAVA像C语言那样从控制台接收输入的字符的方法(一些代码转载)
- [Java] 关于Java,你值得看的一些东西
- 《黑马程序员》java笔记->【02】关于Static静态方法的一些注意事项
- Java基础--关于static的变量和方法使用的一些不解
- 关于Java中Exception类的一些方法
- 关于JAVA-一些要记住的东西
- Java基础知识 十七 (关于反射一些方法的总结)
- 关于将Java中序列化对象写入byte[]遇到的一些问题及解决方法
- 关于这两天的学到的一些java编界面时的一些技巧或方法。
- JAVA关于SET,GET的方法应用和一些问题
- java:关于继承的一些特殊方法.
- 关于Java虚拟机性能调优方法的一些分析
- 关于Java中Exception类的一些方法
- java关于==需要知道的一些东西
- java关于日期的一些常用方法总结
- JAVA基础 - 关于String字符串的一些方法