• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

static and abstract  RSS feed

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why is it not possible to declare a method both static and abstract?
thanks in advance,
sri.
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sri rallapalli,

Static method can't override in sub class. But abstract methods ment to override.

Tip: Abstract method should not have any other non access modifier.

Thnanks,
Seenu
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Tip: Abstract method should not have any other non access modifier.



And not even all access modifiers : "private" is not allowed for the same reason: "abstract" is ment to be overriden , which is not possible for private methods
 
author
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes I've wanted an abstract synchronized method, to enforce synchronized behavior on all subclasses, but the compiler won't let me. I can imagine heavy-duty number crunchers wanting to create abstract strictfp methods, again to enforce behavior on all subclasses, but again it's illegal.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!