This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes What is the Purpose of Having a Nested Java Class That is Private Static Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "What is the Purpose of Having a Nested Java Class That is Private Static" Watch "What is the Purpose of Having a Nested Java Class That is Private Static" New topic
Author

What is the Purpose of Having a Nested Java Class That is Private Static

Natalie Kopple
Ranch Hand

Joined: May 06, 2003
Posts: 320
I understand "private" and "static".

What is the purpose of having a "private static" nested Java class? I have never run into a situation of using it. Please help me in understaning it. Thank you.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

For Utility/Encapsulation purposes. For example the public class may have a private member variable which requires an awful lot of static initialisation that the developer feels belongs 'in a different class', I could see mathematics utilities for example using this technique (but it would be pretty rare).


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: What is the Purpose of Having a Nested Java Class That is Private Static
 
Similar Threads
static and abstract inner class
Static
Nested Classes: When/Why Use? Static vs non-static?
nested interface.
interface implements