You cannot just put a statement like my2Darr[0]= new int[3]; in a class. You have to put it in a method, constructor, or block of code. To see this, the easiest thing to do is put the statement in a code block as in: