Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
java-liu
alibabaStudy
Repository navigation
Code
Issues
Pull requests
9
(9)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
alibabaStudy
/
src
/
main
/
java
/
com
/
exceptions
/
package-info.java
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
16 lines (16 loc) · 961 Bytes
master
Breadcrumbs
alibabaStudy
/
src
/
main
/
java
/
com
/
exceptions
/
package-info.java
Copy path
Top
File metadata and controls
Code
Blame
16 lines (16 loc) · 961 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
* @Description: 总结:
* Java使用异常来表示错误,并通过try{...}catch{...}捕获异常
* Java的异常是class,并且从Throwable继承
* Error是无需捕获的严重错误
* Exception是应该捕获的可处理的错误
* RuntimeException无需强制捕获,非RuntimeException(CheckedException)需强制捕获,或者用throws声明
* 可以有多个catch,catch的顺序非常重要:子类必须写在前面
* 如果某些异常的处理逻辑相同:不存在继承关系,必须编写多条catch子句,可以用“|”表示多种Exception
* 当某个方法抛出异常时:如果当前方法没有捕获,异常就被抛到上层调用方法,直到遇到某个try...catch被捕获,printStatckTrace()可以打印出方法的调用栈
* 如何抛出异常:创建某个Exception的实例,用throw语句抛出
* @Author: Liuys
* @CreateDate: 2020/5/12 13:34
* @Version: 1.0
*/
package
com
.
exceptions
;
You can’t perform that action at this time.