A sealed class is used for representing restricted class hierarchy where an object or a value can have one of the types from a limited… [Read More]
Kotlin Data Class with examples
In Kotlin, you can create a data class to hold the data. The reason why would you want to mark a class as data is… [Read More]
Kotlin Nested and Inner Class with examples
In this guide, you will learn about nested and inner class in Kotlin with the help of examples. Kotlin Nested Class When a class is… [Read More]
Kotlin Interfaces with examples
In this guide, we will learn about interfaces. Similar to an abstract class, an interface cannot be instantiated because it doesn’t have any constructor. Points… [Read More]
Kotlin Abstract Class with examples
An abstract class cannot be instantiated, which means we cannot create the object of an abstract class. Unlike other class, an abstract class is always… [Read More]
Kotlin Visibility Modifiers – public, private, protected and internal
Visibility modifiers restrict the access of classes, interfaces, functions, properties, constructors etc. to a certain level. In kotlin we have four visibility modifiers – public,… [Read More]
Kotlin Inheritance with examples
Inheritance is a feature using which a class inherits all the features of another class. The class from which the features are inherited is known… [Read More]
Kotlin Constructors with examples
The main purpose of constructor is to initialize the properties of a class. Constructor is called when we create the object of a class. In… [Read More]
Kotlin Class and Objects – Object Oriented Programming (OOP)
Kotlin is an object oriented programming language just like Java. Object oriented programming (OOP) allows us to solve the complex problem by using objects. In… [Read More]
Kotlin Try as an expression in Exception handling
The try block in Kotlin can work as an expression. It can return a value just like any other expression, the returned value can be… [Read More]
Kotlin throw keyword with example
In this short guide, we will learn how to throw a exception using throw keyword in Kotlin. Kotlin throw keyword example In the following example… [Read More]
Kotlin Nested Try-Catch Block with example
When a try catch block is present inside another try catch block then it is called nested try catch block. If any exception occurs in… [Read More]
Kotlin Multiple Catch Blocks with example
A try block can have multiple catch blocks. When we are not sure what all exceptions can occur inside the try block then it is… [Read More]
Kotlin Try Catch with example
In the last tutorial we learned what is an exception handling. In this guide we will see various examples of try catch block. We will… [Read More]
Kotlin Exception Handling with examples
Exceptions are unwanted issues that can occur at runtime of the program and terminate your program abruptly. Exception handling is a process, using which we… [Read More]