【发布时间】:2017-03-06 07:34:19
【问题描述】:
这是一个测试程序:
object Test {
def main(args: Array[String]): Unit = {
// there is an unhandled exception in here, I expect program can remind me, and I can handled it before running.
myException()
}
def myException: Unit ={
throw new Exception
}
}
在Java中,当我调用一个带有未处理异常的方法时,程序会出现错误,并告诉你add throws declaration或surround with try/catch。
在Scala中运行之前如何知道程序有未处理的异常?
【问题讨论】:
标签: scala