This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Static classes and Static interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Static classes and Static interfaces" Watch "Static classes and Static interfaces" New topic
Author

Static classes and Static interfaces

Pallavi Sikdar
Greenhorn

Joined: Jan 16, 2004
Posts: 12
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

Joined: Sep 24, 2003
Posts: 1608
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.


Tony Morris
Java Q&A (FAQ, Trivia)
Pallavi Sikdar
Greenhorn

Joined: Jan 16, 2004
Posts: 12
Thanks Tony!!!
Kishore Shewani
Greenhorn

Joined: Jan 23, 2004
Posts: 14
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


Toil and see your dreams coming true. <br />:-)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Static classes and Static interfaces
 
Similar Threads
Help on explanation on Top level class
Diff. b/w Names Inner,Anonymous,Local..
Nested Interfaces
Can interface include Anonymous class?
i need some explanation..