I wrote following program,it compiles and runs fine.But I was expecting compilation error for {} I am not able to undestand why does Java allows to have {} inside a method? Is it treated as Instance Initializer block?
it's perfectly legal to have a code block within a code block. i don't think it is commonly used, but the main effect is to limit the scope. the code below shows an example of how it works:
use the [CODE] tags - it makes it much easier for people to help you.