WEB Button DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Kotlin - Exception Handling


Exception dealing with is a very important a part of a programming language. This method restricts our application from producing the wrong output at runtime.

Kotlin is pretty similar to the exceptions in Java. All the exceptions are descendants of the “Throwable” class.


fun essential(args: Array<String>) 
   strive 
      val myVar:Int = 18;
      val v:String = "welookups.Com";
      v.ToInt();
    catch(e:Exception) 
      e.PrintStackTrace();
    subsequently 
      println("Exception Handeling in Kotlin");
   

Hence, we can get the following output within the browser.
val myVar:Int = 18 ;
Exception Handeling in Kotlin

Note− Like Java, Kotlin also executes the in the end block after executing the capture block.