We can declare strictfp for classes and methods but not for variables.
Usually, the result floating point arithmetic is varied from platform to platform. If we want to platform independent result for floating point arithmetic then we should go for strictfp modifier.
Usually, the result floating point arithmetic is varied from platform to platform. If we want to platform independent result for floating point arithmetic then we should go for strictfp modifier.
1.strictfp( ):-
abstract strictfp class Test
{
}
Valid
example 2:-
abstract strictfp void m1( );
Compile Time Error: illegal combination of modifiers: abstract and strictfp
Next: Java - public,default,private,protected modifier / Chapter -5
Back:Java - abstract modifier / Chapter -3/ Access Modifier
- If a method declared as strictfp( ) all floating point calculation in that method has to follow IEEE 754 standard.So that we will get platform independent results.
- abstract modifier never talks about implementation where as strictfp method always talks about implementation hence abstract strictfp combination is illegal for methods.
- If a class declared as strictfp then every floating point calculation present in every concrete method has to follow IEEE 754 standard so that we will get platform independent result.
- We cannot abstract strictfp combination for classes so that abstract strict combination is legal for classes but illegal for methods.
abstract strictfp class Test
{
}
Valid
example 2:-
abstract strictfp void m1( );
Compile Time Error: illegal combination of modifiers: abstract and strictfp
Next: Java - public,default,private,protected modifier / Chapter -5
Back:Java - abstract modifier / Chapter -3/ Access Modifier
No comments:
Post a Comment
Be the first to comment!
Don't just read and walk away, Your Feedback Is Always Appreciated. I will try to reply to your queries as soon as time allows.
Note:
1. If your question is unrelated to this article, please use our Facebook Page.
2. Please always make use of your name in the comment box instead of anonymous so that i can respond to you through your name and don't make use of Names such as "Admin" or "ADMIN" if you want your Comment to be published.
Regards,
JavaByChetan
Back To Home