WEB Button DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Kotlin - Exception Handling


Exception handling is a very important part of a programming language.

The exceptions in Kotlin is pretty similar to the exceptions in Java.All the exceptions are descendants of the "Throwable" class.
fun main(args: Array<String>) {
   try {
      val myVar:Int = 12;
      val v:String = "Tutorialspoint.com";
      v.toInt();
   } catch(e:Exception) {
      e.printStackTrace();
   } finally {
      println("Exception Handeling in Kotlin");
   }
}
Hence, we will get the following output in the browser.
val myVar:Int = 12;
Exception Handeling in Kotlin