I m from C and C++ programming world.
There i saw that a static variable in a method lives between two function calls.
Right??
But in JAVA it is valid.
Look at this code carefully.....
[code=java]
class Sample
{
//Some code
void test()
{
//Some code
static int a; //It is not valid ... the compiler error message flashes.
//Some code
}
//Some code
}
[/code]
Plz explain ....
Kind regards,
Dmjpro.
There i saw that a static variable in a method lives between two function calls.
Right??
But in JAVA it is valid.
Look at this code carefully.....
[code=java]
class Sample
{
//Some code
void test()
{
//Some code
static int a; //It is not valid ... the compiler error message flashes.
//Some code
}
//Some code
}
[/code]
Plz explain ....
Kind regards,
Dmjpro.
Comment