i know it is not possible .....
in C and C++ there is a way to access the outer varibale using ::(scope resultion operator)
why this is stopped in java?????
thanxxxxxx
Even in c++ that wont work dj. You use the scope resolution operator when you have the context.
in
the context of i is the function test.
in
- void test{
-
int i;
-
{
-
int y;
-
}
-
}
-
The contect of y is still the function test. The {} cannot be named and so you cannot use :: with it. The scope of y is still the function test.
so having
- void test{
-
int i;
-
{
-
int i;
-
}
-
}
-
wont work because both have the same context i.e the function test and so you have a duplicate variable name