Skip to content

Added exception-handling with try-catch-finally sample code and documentation#14

Open
ashan-tharaka wants to merge 2 commits intoTechEx-Academy:mainfrom
ashan-tharaka:my-branch
Open

Added exception-handling with try-catch-finally sample code and documentation#14
ashan-tharaka wants to merge 2 commits intoTechEx-Academy:mainfrom
ashan-tharaka:my-branch

Conversation

@ashan-tharaka
Copy link
Contributor

No description provided.

Comment on lines +1 to +19
#Handling Exceptions
####● Two ways of handling exception
#####○ try-catch-finally
#####○ throws keyword
#####● Try-catch-finally handles exception where it occurs



#Try-Catch-Finally
####Consists of Three parts
######1.Try Block
######Risky codes goes here eg: System.out.println(5/0);
######2.Catch block
###### Handler code goes here eg: System.out.println(e.getMessage());
######3.Finally Block
######This will executed even though exception occurred or not Only JVM shutdown stop executing this part

#####● Try block can’t exist without catch block or finally block
#####● Catch or finally blocks cannot exist without try block No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please elaborate more what is an exception and how it occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants