xxxxxxxxxx
try{
// wirte here somethin that you thought it would throw expection
}
catch(e:Expection){
e.printstacktrace()
// handle expection or write upper line of code
}
finally{
// this block is optional
// this will always run if expection come or not
}
xxxxxxxxxx
try {
// some code
}
catch (e: SomeException) {
// handler
}
finally {
// optional finally block
}
xxxxxxxxxx
try {
// some code
}
catch (e: SomeException) {
// handler
}
finally {
// optional finally block
}