· 网络编程· 网页设计· 图形图像· 网站联盟· 数 据 库· 站长时代· 业界资讯· 网站运营· 黑客攻防· 电脑技巧

站长资讯 News
· ASP 专区 · PHP 专区
· JSP 专区 · NET 专区
· XML 专区 · CGI 专区
· 其他相关
热门文章
· FlashMdy快乐行
· 什么是Web3.0
· The World浏览器秘技..
· 游荡在个人网站大潮..
· ASP中Request对象获..
· 今日(2006-11-26)域..
· 实战 FastCGI_2. 安..
· 黑客入侵“在线影院..
· [图文] 认识FrontPag..
· [图文] 谢文写诗袒露..
相关文章
· JavaScript代码可导..
· Sun升级Java版本 5个..
· 好用的轮播广告Java..
· [图文] JavaScript实..
· 谈AJAX的安全性及AJ..
· 谈AJAX的安全性及AJ..
· Web 2.0中AJAX技术应..
· Java socket 入门编..
· 一个java程序员的成..
· JAVA学习之路:不走..
您当前的位置:资源库 -> 网络编程 -> 其他相关 -> 文章内容
Java关键字: transient | strictfp | volatile
作者:未知  来源:CSDN  发布时间:2006-4-3 6:27:51  发布人:admin

减小字体 增大字体

 

Java Language Keywords

Here's a list of keywords in the Java language. These words are reserved — you cannot use any of these words as names in your programs. true, false, and null are not keywords but they are reserved words, so you cannot use them as names in your programs either.

abstract    |   continue    |   for    |    new     |   switch
assert***  |   default     |   goto*     |   package     |   synchronized
boolean    |   do     |   if     |   private     |   this
break         |   double     |   implements    |   protected    |   throw
byte            |   else     |   import     |   public  throws
case          |   enum****    |   instanceof    |   return     |   transient 
catch         |   extends     |   int     |   short     |   try
char           |   final     |   interface    |   static     |   void
class         |   finally     |   long     |   strictfp**    |   volatile
const*       |   float     |   native     |   super     |   while


*   not used
**   added in 1.2
***   added in 1.4 
****   added in 5.0                                    

 

Key: strictfp**

使用对象:类、方法

自Java2以来,Java语言增加了一个关键字strictfp,虽然这个关键字在大多数场合比较少用,但是还是有必要了解一下。

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

你可以将一个类、接口以及方法声明为strictfp,但是不允许对接口中的方法以及构造函数声明strictfp关键字,例如下面的代码:

1. 合法的使用关键字strictfp

strictfp interface A {}

public strictfp class FpDemo1 {
    strictfp void f() {}
}

2. 错误的使用方法

interface A {
    strictfp void f();
}


public class FpDemo2 {
    strictfp FpDemo2() {}
}

一旦使用了关键字strictfp来声明某个类、接口或者方法时,那么在这个关键字所声明的范围内所有浮点运算都是精确的,符合IEEE-754规范的。例如一个类被声明为strictfp,那么该类中所有的方法都是strictfp的。

 

Keys: volatile

使用对象:字段

介绍:因为异步线程可以访问字段,所以有些优化操作是一定不能作用在字段上的。volatile有时

可以代替synchronized。

 

Keys:transient



 
 
[] [返回上一页] [打 印]
上一篇文章:Java Nested class