Hi...akhil..
but the very general assumption is, "flow of execution is alway from top to bottom"
yes during execution ....we can say that line by line when it is executing... it will first see the i in the inner block and then when it comes out of it...this i is out of scope and the next i //3 comes into scope...
i in //3 is available throught the class...thats the opinion formed by looking at the class...Similiarly i in //1 is also available...in the scope..
In
java we can use a variable only after declaration...So if we consider this....
//1 is uncommented....and //3 is commented then ..
..it is as per your explanation..
//3 is uncommented and //1 is commented then ..
the inner block i is out of scope after the block and outside the block ...another i is newly declared that is accessible for the rest of the program..
This code ..wil help in the direction..
If you comment the println ...it would compile fine..
Thanks akhil..for the point..