|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
"cannot be resolved as a type" Error
We are working on making our switch to turn on and off our shooter system, a toggle and are getting an error.
Code:
package us.oh.k12.wkw.robot.command;
public class ToggleMotorStateCmd extends CommandBase {
public ToggleMotorStateCmd(){
super("ShooterTurnMotorOffCmd");
this.requires(this.getShooterSystem());
}
protected void execute() {
if (!this.getShooterSystem().isShootMotorOn()) {
// motor is off, turn it on
this.getShooterSystem().turnOnShootMotor();
} else{
//motor is on, turn it off
this.getShooterSystem().turnOffShootMotor();
}
}
}
Code:
package us.oh.k12.wkw.robot.command;
public class GathererTurnOnCmd extends CommandBase{
//code
}
|
|
#2
|
|||
|
|||
|
Re: "cannot be resolved as a type" Error
"X cannot be resolved as a type" errors are commonly caused by two reasons:
1. Missing import statement, wrong package. 2. Referring to a type that doesn't exist. If you are using an IDE, there should be a way to automatically remedy this. Also, doesn't Java make your implement all the methods of the abstract class? Code:
protected void execute() {
}
protected boolean isFinished() {
}
protected void end() {
}
protected void interrupted() {
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|