posted 13 years ago
Let us take an example when you want to use methods of another class but its constructor is private so that you cannot create an object. In that case, make the specific method which you want to use anyhow, as static
So basically, you can use static if you want to access any method or variables without creating object of the class.
You can also use static block
static()
{
...
}
static blocks are executed before main(). So you can write statements here too. For example: giving some instructions to the user before he enters some value