0
有人可以幫我解決這個問題。有編譯錯誤$SwitchMap$uk$ac$aber$dcs$blockmotion$gui$Direction
和InputMismatchException
我該寫什麼呢?反編譯器代碼錯誤
以下是整個功能。如果有人能給我一個簡短的解釋讓我明白髮生了什麼,我會很感激。
private void setSlideNumber(String msg, Direction direction) {
boolean tryAgain = true;
do {
System.out.println(msg);
try {
int ime = Math.abs(this.in.nextInt());
switch(null.$SwitchMap$uk$ac$aber$dcs$blockmotion$gui$Direction[direction.ordinal()]) {
case 1:
this.slideHorizontalLeftNum = -ime;
((SlideTransformer)this.slideHorizontallyLeftTransformer).setAmount(this.slideHorizontalLeftNum);
break;
case 2:
this.slideHorizontalRightNum = ime;
((SlideTransformer)this.slideHorizontallyRightTransformer).setAmount(this.slideHorizontalRightNum);
break;
case 3:
this.slideVerticalUpNum = -ime;
((SlideTransformer)this.slideVerticallyUpTransformer).setAmount(this.slideVerticalUpNum);
break;
case 4:
this.slideVerticalDownNum = ime;
((SlideTransformer)this.slideVerticallyDownTransformer).setAmount(this.slideVerticalDownNum);
}
tryAgain = false;
} catch (InputMismatchException var8) {
System.out.println("Please type a valid number");
} finally {
this.in.nextLine();
}
} while(tryAgain);
}
順便說一句,Direction
是一個枚舉
,這是幻燈片變壓器
public abstract class SlideTransformer implements Transformer {
int amount;
public SlideTransformer(int amount) {
this.amount = amount;
}
public int getAmount() {
return this.amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
}
現在枚舉方向的代碼類:
public enum Direction {
LEFT,
RIGHT,
UP,
DOWN;
private Direction() {
}
}
什麼是nu $ SwitchMap $ uk $ ac $ aber $ dcs $ blockmotion $ gui $方向 – Arvindsinc2
InputMismatchException的錯誤是什麼? –
從哪裏得到'null。$ SwitchMap $ uk $ ac $ aber $ dcs $ blockmotion $ gui $ Direction [direction.ordinal()]'這個想法是否正確Java? –