i have a class like that in the package map1:
import android.graphics.Bitmap;
public class Map {
public Bitmap Structure;
public String name;
public Integer ID;
}
in a different project a have the following code:
public class dummy {
map1.Map MM = new map1.Map();
MM.ID = 5;//this line is a error: "Syntax error on token "ID", VariableDeclaratorId expected after this token"
}
i checked the references and all is O.K. (as far as I could tell)
i have a different and there all works fine. i couldn’t find any significant difference, but I’m quite new to eclipse.
why does that happen and how do I make my second project work?
Your code is broken, basically. This statement:
is not inside a constructor, method, or initializer. It needs to be. For example, you might want to put it in a constructor:
I suspect your other working class doesn’t have such a syntax error.
(Aside from that, it would be a very good idea to start using private variables, avoiding clashes with standard library types such as
Map, and following Java naming conventions.)