why objects are declared as both private and static at the same time
Static means global and private means access within that class only. Then how come they both be applied in one method.
following line describes the method which is declared both as static and final. Somebody please give me solution.
private static Object lookupHome(java.util.Hashtable environment, String jndiName, Class narrowTo) throws javax.naming.NamingException {
[388 byte] By [
nusaira] at [2007-10-2 2:37:36]

Thank u so much for ur reply. But my doubt is not whether can i declare methods as static and private or not but why should i declare like that. I.e., why will i need to declare my method to be both private and static?Please give me the answer for WHY?
Because you want the method to be accessible only within the class.
When I've done it, it's just to keep things encapsulated. If you don't need the method or field accessible from outside the class, make it private, otherwise it might be used in ways you didn't anticipate. If it doesn't need instance state, make it static.
Some texts say to declare constants as "public static final", but I say to make them "private static final" if you don't have a specific reason why the constants need to be accessible outside the class.
Thank u Paul. I got it. So if a method is declared as both private and static then within that class without instantiating object one can access that method but not outside of it.
Paul if u could help me with another error "Cannot allocate servlet instance for the path" while deploying servlet in Eclipse, i will be much more pleased.
If you have a private static method, it can be invoked by other static methods in that class, or it can be invoked by non-static methods inside that class.
A static method can only call other static methods, but a non-static method can call static methods.
I've never tried to deploy a servlet from inside Eclipse, so I can't help you with that.
> Paul if u could help me with another error "Cannot
> allocate servlet instance for the path" while
> deploying servlet in Eclipse, i will be much more
> pleased.
When people have errors using eclipse, I usually sugget they try one of the eclipse support forums.