OOP

Kotlin Sealed Classes

Having gone through the concepts of classes in Kotlin, we understand that classes form the basis for any OOP’s oriented language and Kotlin is no different. As evident from the name itself, Sealed Classes are the classes which are closed or sealed, which makes their usage restricted.

Kotlin Exception Handling

In this tutorial we will discuss about Kotlin exception handling concept in detail. Errors, Exceptions are the developer’s nightmare as well as help guide. Let’s understand the basic difference between Error and Bugs. Anything which breaks the normal flow of control of a program can be termed as an Exception.

Kotlin Null Safety

As a developer, we always have faced NullPointerException, or commonly known as ‘The Billion Dollar Mistake’. Every introduction of kotlin talks about the kotlin’s capablity to handle Null Pointers. Yes, take it as a relief Kotlin can handle null pointers for you, thanks to its type system.

Kotlin Interface

Talking about interface, there are two types of implementations which exists, the pre Java 8 ones where interfaces could contain only abstract methods. But in the recent update of Java 8, where interfaces were allowed to have implementations of methods as well as abstract methods. Kotlin offers similar type of interfaces i.e. Interface in kotlin …

Kotlin Interface Read More »

Kotlin Abstract Class

A class which is declared with keyword ‘abstract’ is termed as Abstract Class, these can also be termed as classes which can’t be instantiated. Or in Simple words, we cannot create objects of Abstract classes. Similar to Java, abstract classes in Kotlin can be inherited in sub classes.

Kotlin Constructors

Having read about the kotlin classes and objects, let’s have a look at initialization of class objects. This can be done using constructors. So in simple words: “A constructor is a special member function which is called when the object is instantiated or created.”

Kotlin Data Classes

Having read about classes and objects in detail, we now can recall of scenarios in our applications where we create certain classes which act as place holder for the data. Along with data these classes contain basic standard functions and utilities. The common functions these class hold are the getters, the setters, the toString method, …

Kotlin Data Classes Read More »

Kotlin Classes and Objects

Before we move ahead with the basic user defined data structure of classes and the ways to use them by the means of Object, let’s have a look at the fundamentals which go inside Kotlin.