my dog learned polymorphism
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes strictfp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "strictfp" Watch "strictfp" New topic


Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
strictfp can be applied as a modifier to a class or interface or method. Its not inherited.

Suppose there is a non strictfp class A and it has a strictfp method method(). If there is a class B that extends A but does not override the method- method().

1- In the inherirted method would the method- method() be strictfp or not?

2- Also if some other method- method1() in the extending class B used the method- method() would method() be executed in a strict fashion?
Gian Franco
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi Swamy,

From the results of the following code:

resulting in:

public static void D.main(java.lang.String[])
public strictfp int D.method2()
public strictfp int C.method1()public native int java.lang.Object.hashCode()
public final native java.lang.Class java.lang.Object.getClass()
public final void java.lang.Object.wait() throws java.lang.InterruptedException
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
public boolean java.lang.Object.equals(java.lang.Object)
public final native void java.lang.Object.notify()
public final native void java.lang.Object.notifyAll()
public java.lang.String java.lang.Object.toString()

it seems like the strictfp modifier is inherited as is.
I'm not familiar enough with the reflexion classes though
to entirely exclude the possibility that strictfp is not
inherited given the above results.

Maybe someone else might pop in with an answer.


Gian Franco Casula
[ May 19, 2004: Message edited by: Gian Franco Casula ]

"Eppur si muove!"
Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
I hope it is out of syllabus
Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
That was smart of u to use Reflection.
Wonder if anyone will step up and point to a affirmative answer.
(Dont want to wade through a lengthy document also)
I agree. Here's the link:
subject: strictfp
It's not a secret anymore!