我向你保证这将是一个非常愚蠢的问题,但我脑子有问题,不知道如何解决这个错误。我正在使用 Java 并尝试定义一个枚举。
public enum ShooterStatus{
OFF,EXTENDING,CONTRACTING,LOADED
}
这个枚举是在另一个类中定义的。编译时,我收到以下错误:
Implicit super constructor Enum(String, int) is undefined for default constructor. Must define an explicit constructor
我在这里想念什么?枚举声明不应该就是这样吗?(我习惯用 C 编程)
包含类:
package org.usfirst.frc3777;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.Timer;
public class Shooter {
public enum ShooterStatus{
OFF,EXTENDED,CONTRACTING,LOADED
}
SpeedController upperCont;
SpeedController lowerCont;
DoubleSolenoid dS;
Boolean isLoaded;
Boolean isRunning;
Timer mainTimer;
DoubleSolenoid.Value extend = DoubleSolenoid.Value.kForward;
DoubleSolenoid.Value compress = DoubleSolenoid.Value.kReverse;
DoubleSolenoid.Value off = DoubleSolenoid.Value.kOff;
String label = "Shooter";
private boolean wheelsRunning(){
return upperCont.get()>.5&&lowerCont.get()>.5;
}
public Shooter(SpeedController upperCont, SpeedController lowerCont, DoubleSolenoid dS){
this.upperCont = upperCont;
this.lowerCont = lowerCont;
this.dS = dS;
}
private void setExtendPiston(){
dS.set(extend);
}
private void setCompressPiston(){
dS.set(compress);
}
private void setOffPiston(){
dS.set(off);
}
public boolean startShootingThread(){
if(!isLoaded){
Log.info(label, "Shooter is not currently loaded in logic");
return false;
}
if(isRunning){
Log.info(label, "Shooter is currently running");
return false;
}
setExtendPiston();
}
}