• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

public strictfp abstract class A{}

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, is this combination [strictfp and abstract modifiers foa a class] possible? I just dived into Kathy/Bert's book
 
Marshal
Posts: 79236
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch

Have you tried it? The compiler is usually very quick to tell you you have made a mistake. There should be more details in the Java Language Specification. You will have to find the index.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tiju Thomas:
Hi all, is this combination [strictfp and abstract modifiers foa a class] possible? I just dived into Kathy/Bert's book



Did you compile it ?
 
Tiju Thomas
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Campbell and John. It compiled fine.

But my doubt arised due to this line in the book.

"Because interface methods are abstract, they cannot be marked final,
strictfp, or native"

I thought why not then for abstract classes?
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Abstract classes may include non-abstract methods as well.
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the rule that you written here is applicable only to interface METHODS.
you can apply strictfp on interface or abstract class declaration, but you can not use it on abstract methods whether they belong to class or to interface.


 
Tiju Thomas
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ivan and Swapnil
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's important that you understand what strictfp do. This is a modifier that guarantee that all floating point operation will behave a certain way (according to a standard that I don't actually know). Java is capable of more precise calculations that that standard, but it�s usually used when you are expecting an exact output on a floating point operation. So, as you can see, this is a modifier that involve implementation, and can be applied to classes or method were there actually can be implemented operations.

On interfaces, there is no non-abstract methods, so it doesn't apply. On abstract classes, there can be non-abtract methods, so it can be strictfp and will aplly only to those methods implemented. On abtract methods, there is no implementation, so strictfp doesn't apply either.
[ May 29, 2008: Message edited by: Daniel Del Moral ]
 
Don't listen to Steve. Just read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic