error: Illegal modifier for parameter

风格不统一 提交于 2019-12-20 04:54:25

问题


I was using these lines of code...

public static final int WIDTH = 240;
public static final int HEIGHT = 350;
public static final int SCALE = 2;

but I always got these errors ...

Illegal modifier for parameter WIDTH; only final is permitted
Illegal modifier for parameter HEIGHT; only final is permitted
Illegal modifier for parameter SCALE; only final is permitted

回答1:


I expect that you are trying to use public and static on local variable declarations or method parameter declarations. Locals / parameters can only be final.

You can only use public and static on class members (or similar).



来源:https://stackoverflow.com/questions/15747231/error-illegal-modifier-for-parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!