Header Ads

Strictfp Modifier in java | Access Modifiers in java-Pingjava

Strictfp Modifier in java

Strictfp Modifier in java



Strictfp:


1. strictfp is the modifier applicable for methods and classes but not for variables.

2. Strictfp modifier introduced in 1.2 versions.

3. Usually the result of floating point of arithmetic is varing from platform to platform,to overcome this problem we should use strictfp modifier.

4. If a method declare as the Strictfp then all the floating point calculations in that method has to follow IEEE754 standard, So that we will get platform independent results.



Example:


System.out.println(10.0/3);

P4  -------->3.33333333333333

P3  -------->3.333333

IEEE754 ---->3.333


If a class declares as the Strictfp then every concrete method(which has body) of that class has to follow IEEE754 standard for floating point arithmetic, so we will get platform independent results.




What is the difference between, abstract and strictfp ?

1. Strictfp method is about implementation where as abstract method never talks about implementation hence abstract, strictfp combination is illegal for methods.

2. But we can declare a class with abstract and strictfp modifier simultaneously. So from these,abstract strictfp combination is legal for classes but illegal for methods.








Example:


public abstract strictfp void methodOne(); (invalid)


abstract strictfp class Test (valid)

{


}



An Inspirational quote: 

"
Don’t Let Yesterday Take Up Too Much Of Today." 



Steps to Subscribe my blog in 15 secs:
1. Enter your mail id in "Subscribe" box.
2. Enter Captcha for verification.
3. A mail will be received with link in your mail id.Just Click on link  and  then Done .Thank you for subscribing :)

Another way to subscribe: Click here to Subscribe PingjavaOfficialSite by Email

Happy Reading.Happy Learning!!! See you in next post  
:)

No comments

Note: Only a member of this blog may post a comment.