Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • How to Use 'strictfp' in Java.

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 359
    Comment on it

    In Java Programming, we all are aware that precision in result specially in floating-point numbers vary from platform to platform. In order to avoid such consistency in result over different platform, Java language provides the keword named 'strictfp'. This keyword can be used in order to get precise answer in any platform.

    Lets discuss where it can used or not. 'strictfp' can be used be on methods, classes, and interfaces. But don't use on constructors, variables, or abstract keyword.

    Following example show how to use this.

     

    1.  
      strictfp class Demo 
      {
      //Statements
      }

       

    2. Class Demo
      {
      public strictfp void display(){}
      }
      
       
    3. strictfp interface Demo{}

       

    Below example shows Not to use strictfp on ;

    1. class Demo
      {
      strictfp Demo()  // Invalid Declaration
      {
      }
      }

      2.

      Class Demo
      {
      strictfp int a=10; // Illegal variable declartion
      }

      3.

          class Demo{  
          strictfp abstract void display();//Illegal modifiers  
          }  

       

     

    Java strictfp

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: