freetimestudys@gmail.com          +91-7097633380
  Login Here                        

Strictfp modifier

1.Strictfp is a modifier applicable for classes and methods.
2.if a method is declared as strictfp all floating point calculations in that method will follow IEEE754 standard. So that we will get platform independent results.
3.If a class is declared as stictfp then every concrete method in that class will follow IEEE754 standard so we will get platform independent results.

strictfp program

strictfp class Test
{
void m1()
{
System.out.println("m1 fallows floating point calculations IEEE754 format");
}
public static void main(String[] args)
{
System..out.println("main method fallows IEEE754 format");
}
};

intput and output

output:main method fallows IEEE754 format

Native

1.Native is the modifier only for methods but not for variables and classes.
2.The native methods are implemented in some other languages like C and C++ hence native methods also known as foreign method 
3.For native methods implementation is always available in other languages and we are not responsible to provide implementation hence native method declaration should compulsory ends with “;”.
Ex: - public native String intern();
 Public static native void yield(); 
Public static native void sleep(long);