Scope of static variable is with in the file if it is static global.
Scope of static variable is with in the function if variable is declared local to a function.
But the life time is throughout the program
Local function variables defined static remain in memory at all times. Such variables are only in scope (accessible) when the function itself is in scope.
No, static variables are not serialized.
Static functions are tied to a class, not to a particular object. A static function can only access static variables because it has no knowledge of member variables.
A variable declared static outside of a function has a scope the of the source file only. It is not a global variable. A variable declared outside of a function and without the static qualifier would be a global variable.
No. You will get compilation errors. The complier will complain that you are trying to access non static variables from inside a static method. A static method can access only static variables.
In java we access static variables and static methods without creating objects. i.e.,we can access directly by using classname we can also access static variables and static methods by using objects which are created by using class where the static variables and static methods are available
A static variable is one which is not stored on the stack but in the memory of the program. Static variables can be changed.
Yes, they can
The program's data segment. This area of memory is allocated by the linker and is used to store the program's global variables, static variables, static arrays and constants. Constants are always initialised, as are static variables, but global variables and static arrays need not be initialised.
Automatic storage is the default storage class for all non-static local variables including formal arguments. All automatic variables are allocated on the call stack and are automatically released when they fall from scope.
Short answer: No. Only class member variables may be declared static. Local variables with a static declaration will throw an error (usually "illegal start of expression").
yes bcoz static variables