Vishal Hegde wrote:Hi Please adivce where I am going wrong
Where you're going wrong is 1) Not telling us clearly and precisely what you're trying to do and 2) Not telling us clearly and precisely exactly what problems you're encountering.
All statements must be inside a method, constructor, or initializer block. The only things that can occur outside those contexts are member variable definitions and definition+initialization combinations.
The line
does not fit those criteria, so it has to be inside a method, constructor, or initialization block.