• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

modifers

 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know what these modifiers do? Because then you understand why then can't be combined.
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then why is abstract+ strictfp legal for classes?
 
Ankit Garg
Sheriff
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Erap Estrada
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great questions and great answers. Thanks a lot guys!
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic