• Post Reply Bookmark Topic Watch Topic
  • New Topic

Static classes and Static interfaces  RSS feed

 
Pallavi Sikdar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Maybe this sounds a bit stupid, but what exactly are static classes and static interfaces? What is their use? I could not get hold of any satisfactory material.Can any one Help??
Thanks
Pallavi.
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
static classes/interfaces MUST declared as inner classes/interfaces.
You might benefit from investigating the use of inner classes/interfaces.
You'll receive varying opinions regarding their use, since there is an on-going subjective debate about when, and how they are used, if ever.
 
Pallavi Sikdar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tony!!!
 
Kishore Shewani
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I just saw ur query ( a bit of confusing though static classes are but u see not everything is fare when it comes to code ).
First thing is that inner classes are complied in a seperate .class file .
So if you want do some operations just at development time ( like testing and debugging) you can include its code in an inner class. While you may not deploy this .class file at runtime ( a big benefit when it comes to testing and t hen deploying web applications).
While the inner class can access members of outer class it is tightly coupled wtih outer class which is against Encapsulation.
Also sometimes they make the code really puzzling
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!