syed Imran wrote:collection you are populating must be inside a method or in a static block at class level....
Not static of course, since the List is not static. An initializer block (a static block but without the static key
word) is what you probably meant.