Java 关键词strictfp是什么意思?
有人解释一下在下面的课程中关键字Java 关键词strictfp是什么意思?,java,Java,有人解释一下在下面的课程中关键字strictfp是什么意思 public strictfp class Demo { public static void main(String[] args) { double d = 8e+307; /** affiche 4 * d /2 donc 2 * d */ System.out.println(4 * d / 2);
strictfp
是什么意思
public strictfp class Demo {
public static void main(String[] args) {
double d = 8e+307;
/** affiche 4 * d /2 donc 2 * d */
System.out.println(4 * d / 2);
/** affiche 2 * d */
System.out.println(2 * d);
}
}
Java strictfp关键字确保如果在浮点变量中执行操作,在每个平台上都会得到相同的结果。strictfp关键字可以应用于方法、类和接口
strictfp class A{}//strictfp applied on class
strictfp interface M{}//strictfp applied on interface
class A{
strictfp void m(){}//strictfp applied on method
}
strictfp关键字不能应用于抽象方法、变量或构造函数
class B{
strictfp abstract void m();//Illegal combination of modifiers
}
class B{
strictfp int data=10;//modifier strictfp not allowed here
}
class B{
strictfp B(){}//modifier strictfp not allowed here
}
thnx但是浮点变量是什么意思呢?@hulk,浮点变量是一个可以存储数字的变量,比如2.6、8.430、0.086等等。基本上,它可以存储包含小数的数字。@Karthikeyan Vaithilingam我也发现了这个