I am sure there's a super simple explanation and it'll make me feel stupid, but I just can't figure it out. Pastebin , line 18:
public static boolean loadTextures() {
try {
final Texture STONE = loadPNG("main\\textures\\stone.png"); // This line here I can't do public static final...
} catch (IOException e) {
return false;
}
return true;
}
I would like STONE
to be public static final
, but eclipse says only final
is a legal modifier.
How would I go about declaring a public static final
variable?
You can't declare a static variable inside a method, since a method has only local variables.
Move it outside your method.
Change this :
public static boolean loadTextures() {
try {
final Texture STONE = loadPNG("main\\textures\\stone.png"); // This line here I can't do public static
to this :
public static final Texture STONE = loadPNG("main\\textures\\stone.png");
public static boolean loadTextures() {
try {