• 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

static class

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
We know that abstract and static modifiers don't go together as far as methods are concerned.abstract and static modifier can be applied together to member classes.Why is the behaviour different when it comes to classes inside a interface or class?
Thanks,
vinu.
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some modifiers can be or cannot be applied to class declarations depending on the circumstances.

For example, Top Level classes cannot be private or protected, however nested inner classes, as they are class member can ben declared protected or private.

Now, a method cannot be abstract and static at the same time in any context. There is a logical reason: when a method is declared abstract it is because it has to be implemented through inheratance. However static methods are not inherited, so there would be no way to implement a static abstract method.

It is different with member classes, because they do not behave as methods. And I guess that if the nested class has an abstract method therefore the class has to be declared abstract whether it is static or not, just as any other class.

It is different in this case, because the abstract static class still can be inherited and its abstract methods implemented.
 
vinuharan haran
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Edwin.
-vinu.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic