GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes modifers 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 "modifers" Watch "modifers" New topic
Author

modifers

Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
this one was from examlabs.....

why is native + abstract illegal?

and why is abstract + strictfp illegal for methods but legal for classes?

and why is synchronized + native legal?

please give me some link which explains all this....


scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Do you know what these modifiers do? Because then you understand why then can't be combined.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
native means that the method is denifed in some other platform

strictfp can be allpied to classes and methods...and it is related something to floating point integers..am not clear

Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

native and abstract can't be combined because native means that it is implemented by a native library (dll) and abstract means that it must be implemented by a concrete java class.
strictfp is intended to modify the behavior of a single specific implementation, so it doesn't make sense to talk about a strictfp abstract method. Strictfp is not inherited.
synchronized + native is legal because then the native method has a lock on the object
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
then why is abstract+ strictfp legal for classes?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

Raju Champaklal wrote:then why is abstract+ strictfp legal for classes?

What is the use of putting strictfp modifier with an abstract method?? abstract method doesn't have any body, so there's no strict floating point calculations in it. Try to create an abstract method, and implement it in a sub-class and add structfp modifier to the implementation, it will compile fine. So basically abstract method which doesn't have strictfp modifier can be overridden by a method with strictfp modifier...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Erap Estrada
Ranch Hand

Joined: Nov 08, 2006
Posts: 92
Great questions and great answers. Thanks a lot guys!


SCJP with 98% by...
 
GeeCON Prague 2014
 
subject: modifers