你知道有哪种语言会在溢出或下溢时抛出异常吗?由于
。. Net框架有一个专门的溢出异常
OverflowException类
在c#中,您可以使用checked
关键字让下流和溢出抛出异常:
int a = checked(Integer.MIN_VALUE - 1);