public void processString(String input) throws InvalidInputException {//processes the string to check if the characters correct and what method it should go to
for (char x : input.toCharArray()) {//for loop which checks each char
switch (x) {
case 'L' : turnLeft();
break;
case 'R' : turnRight();
break;
case 'M' : moveRover();
break;
default : throw new InvalidInputException("Invalid signal");
}
}
}
我有这个代码但是我得到一个找不到符号错误我做错了什么?
我收到此错误消息
public void processString(String input) throws InvalidInputException {//processes the string to check if the characters correct and what method it should go to
^
symbol: class InvalidInputException
location: class marsRover
marsRover.java:47: error: cannot find symbol
default : throw new InvalidInputException("Invalid signal");
^
symbol: class InvalidInputException
location: class marsRover
2 errors