gpt4 book ai didi

java - Java 中的 C# InvalidEnumArgumentException

转载 作者:行者123 更新时间:2023-11-30 02:42:10 24 4
gpt4 key购买 nike

有没有类似InvalidEnumArgumentException的东西在java中?

用例:

public FigureType determinateFigureType(int row, int column) throws ??? {
switch (globalSheet[row][column]) {
case FIELD_FREE:
return FigureType.Free;
case FIELD_A:
return FigureType.A;
case FIELD_B:
return FigureType.B;
default:
throw new ???();
}
}

最佳答案

也许IllegalArgumentException

Java API :

Thrown to indicate that a method has been passed an illegal or inappropriate argument.

还有一个EnumConstantNotPresentException ,但是,这似乎不是您要寻找的。

关于java - Java 中的 C# InvalidEnumArgumentException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41321312/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com