Java Class, Method, and Variable Modifiers

abstract A method or class that cannot be instantiated, and which may define methods to be overwritten. 

class Keyword used to specify a class.

extends Used to indicate the superclass that a subclass is extending.

final Makes it impossible to extend a class, override a method, or reinitialize a variable. both member and local final variable must be initialized.

implements Used to indicate the interfaces that a class will use.

interface Keyword used to specify an interface.

native Indicates a method is written in a platform-dependent language, such as C.

new Used to instantiate an object by invoking the constructor method.

static Makes a method or a variable belong to a class.

strictfp Used in front of a method or class to indicate that floating point numbers will follow FP-strict rules in all expressions.

            strictfp的意思是FP-strict,也就是说精确浮点的意思。在Java虚拟机进行浮点运算时,如果没有指定strictfp关键字时,Java的编译器以及运行环境在对浮点运算的表达式是采取一种近似于我行我素的行为来完成这些操作,以致于得到的结果往往无法令你满意。而一旦使用了strictfp来声明一个类、接口或者方法时,那么所声明的范围内Java的编译器以及运行环境会完全依照浮点规范IEEE-754来执行。因此如果你想让你的浮点运算更加精确,而且不会因为不同的硬件平台所执行的结果不一致的话,那就请用关键字strictfp。你可以将一个类、接口以及方法声明为strictfp,但是不允许对接口中的方法以及构造函数声明strictfp关键字。

synchronized Indicates that a method can be accessed by only one thread at a time.

transient Prevents fields from ever being serialized. Transient fields are always skipped when objects are serialized.可查看:http://blog.csdn.net/zijinshi/articles/1064817.aspx.

volatile Indicates a variable may change out of sync because it is used in threads.可查看:http://www.ibm.com/developerworks/cn/java/j-jtp06197.html.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值