I hope you already received your answer, if not, then it may be useful to you.
I came across a similar question asked on the forum.
The reason abstract and strictfp cannot sit together in a method declaration is because abstract says that this method should not be implemented by the current class and should be implemented by a specific subclass and strictfp says that the method should be implemented (should have body) by a class where strictfp used. Therefore, in this case, both keywords contradict each other, therefore both of them are not allowed together in method declarations.
But it is absolutely legal to use abstract and strictfp in front of the class. Sort of
public abstract strictfp class MyAbstractClass{}
If you declare strictfp in an abstract class, then by default its entire method will be strictfp. Remember all the specific methods in the class, not abstract methods.
Run the example below and see the OP:
import java.lang.reflect.*; public abstract strictfp class AbstractStrictfp { public abstract void abstractMethod(); public void concreteMethod(){}; public static void main(String args[]){ Method methods[] = AbstractStrictfp.class.getMethods(); for(Method method : methods){ System.out.println("Method Name::"+method.getName()); System.out.println("Modifiers::"+Modifier.toString(method.getModifiers())); System.out.println(); } } }
source share