• 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

Overriding methods, strictfp, final, abstract...

 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
About overriding methods, I understand their access level can not be more restrictive than the access level of the methods being overriden but what about the other modifiers, strictfp, final, abstract , synchronized, can the overriding methods have those modifiers when the method being overriden does not ?
Thx in advance,
Giselle
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The parent is not final - the child can be final.
The parent is not abstract - the child can be abstract.
The parent is not strictfp - the child can be strictfp.
The parent is not synchronized - the child can be synchronized.
 
Giselle Dazzi
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks !
 
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The parent is not final - the child can be final.
The parent is not abstract - the child can be abstract.
The parent is not strictfp - the child can be strictfp.
The parent is not synchronized - the child can be synchronized.


The above lines are true but
The parent is not abstract - the child can be abstract. But if the Parent is abstract the child may or may not be abstract.
The parent is not strictfp - the child can be strictfp. But if the Parent is strictfp the child may or may not be strictfp.
The parent is not synchronized - the child can be synchronized. But if the Parent is synchronized the child may or may not be synchronized.
[ May 20, 2003: Message edited by: Anupam Sinha ]
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why cant a non-static method be over-ridden to be of type static?
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since static methods are not polymorphic it would cause too much confusion.

If I execute B.m() what happens if the author of A changes his code to make m() static?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic