Static methods and variables: the variables that stick to your clothes when you pull them out of the dryer.
If you make a variable static, every instance of the class uses the same object. So, that Connection of yours is going to get passed around between all of your different instances. Germs will spread, and things might get messy.
Connection pooling. That's where it's really at.
If you have problems with static, just throw in some fabric softener. That always seems to do the trick for me.
Cameron Wallace McKenzie
author and cow tipper
you can access it from static context with in class
No, Kameron McKenzie is correct. You can access a static member from a static or instance ("non-static") context. If it is private only from inside the class.
Example of its use: Imagine you have a ListItem classNow you have a private static count field whihc counts how many instances of the class there are, and you can get that information from the public static ListItem.getCount() method.