HACKER
TALK
Home
Channels
beta
Bookmarks
Messages
Notifications
Sign In
Beants
Beants
Beants
Beants
Joined 3 years ago
0 Following0 Followers
JuneJulyAugSeptOctNovDecJanFebMarAprMay
PostsCommentsChannels
Beants
Beants
·3 years ago

我的理解: Exception 肯定是有对应的解决方案的,

这个Exception在对应的位置处理掉就行了,

例如:->接收到了不能处理的数据->处理函数抛出对应异常->外层函数决定该换一种处理方式 还是返回给上层函数

Beants
Beants
·3 years ago

抛 Exception吧

Exceptions should be thrown when the contract between a method and its caller cannot be fulfilled. This is the usage identified in the Java™ Language Specification.

抛出异常不是严格禁止的事情,如果在项目结构中需要处理“函数分内的事情”则不需要抛出异常如果是“分外”的事情,则需要抛出异常。

Terms of ServicePrivacy PolicyCookie PolicyMarkdown SyntaxUser PointsUser Feedback© 2025 Shware Inc.