在Java中,您无法通过引用传递任何参数.
我能想到的唯一解决方法是创建一个包装类,并包装一个枚举.
public class EnumReference {
public YourEnumType ref;
}
Run Code Online (Sandbox Code Playgroud)
然后你会像这样使用它:
public void someMethod(EnumReference reference) {
reference.ref = YourEnumType.Something;
}
Run Code Online (Sandbox Code Playgroud)
现在,引用将包含枚举的不同值; 基本上模仿传递引用.
| 归档时间: |
|
| 查看次数: |
7902 次 |
| 最近记录: |