aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface with strictfp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interface with strictfp" Watch "Interface with strictfp" New topic
Author

Interface with strictfp

karthik panchan
Greenhorn

Joined: Aug 03, 2006
Posts: 2
Hi

I need some help to understand strictfp with interface. Hope some can explain using the following code sample, why I can able to use strictfp with Interface not with Interface Methods.

Interface with StrictFp( this compiles fine in Java 1.5)
--------------------------------------------------------
public strictfp interface checkForStrictFp{
public void isItPossible();
}

Interface with StrictFp and strictfp Method( this gives Compile error)
--------------------------------------------------------
public strictfp interface checkForStrictFp{
public strictfp void isItPossible();
}

C:\Tech\MyJava\checkForStrictFp.java:2: modifier strictfp not allowed here
public strictfp void isItPossible();
^
1 error

Tool completed with exit code 1

Anyone know, why I can't use strictfp with Interface method, which is nothing but "abstract" method.

In "abstract" class, if I had method with "strictfp" it compiles successfully.

Code sample:
------------
public abstract strictfp class checkForStrictFpWithAbstract{
public strictfp void isItPossible()
{
System.out.println("Strictfp confirms with IEEE 754");
}
}

Appreciate any help on this.

Thanks very much.
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
9.4 Abstract Method Declarations

Note that a method declared in an interface must not be declared strictfp or native or synchronized, or a compile-time error occurs, because those keywords describe implementation properties rather than interface properties. However, a method declared in an interface may be implemented by a method that is declared strictfp or native or synchronized in a class that implements the interface.
karthik panchan
Greenhorn

Joined: Aug 03, 2006
Posts: 2
Wise Owen

Thanks for your nice explanation.

Karthik
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interface with strictfp