How to do it...

  1. Invoke the parseInt() function in the try…catch declaration:
try {
parseInt("fdsaa")
} catch (e: NumberFormatException) {
0
}

  1. Assign the result of the try…catch declaration to the value variable:
val result = try {
parseInt("fdsaa")
} catch (e: NumberFormatException) {
0
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.108.176