Category Archives: Kotlin tutorials

Kotlin tutorials category is made for beginners and for experts as well. To start learning kotlin this tutorial could be a good start.
But first let’s talk a little bit about kotlin.

What is Kotlin all about?

It is a new programming language targeting the Java platform. Kotlin is concise, safe, pragmatic, and focused on interoperability with Java code. It can be used almost everywhere Java is used today.

  • For server-side development
  • Android apps
  • JavaScript
  • Native
    • Kotlin/Native is a technology for compiling Kotlin code to native binaries, which can run without a virtual machine.

Kotlin works great with all existing Java libraries and framworks and runs with the same level of performance as Java.

Target platforms: Server-side, Android, anywhere Java runs

The primary goal of Kotlin is to provide a more concise, more productive, safer alternative to Java that’s suitable in all contexts where Java is used today. Java is an extremly popular language, and it is used in a broad variety of environments, from smart cards to the largest data centers run by Google, Twitter, LinkedIn, and other internet-scale companies. In most of these places, using Kotlin can help developers achieve their goals with less code and fewer annoyances along the way.

The most common areas to use Kotlin are

  • Building server-side code (typically, backends of web applications)
  • Building mobile applications that run on Android devices

In addition to Java, Kotlin can be compiled to JavaScript, allowing you to run Kotlin code in the browser.

Abstract Class

In Kotlin, abstract class is declared using the abstract keyword in front of class. An abstract class can not instantiated means we can not create object for the abstract class.

Important points

      • We can’t create an object for abstract class.
      • All the variables (properties) and member functions of an abstract class are by default non-abstract. So, if we want to override these members in the child class then we need to use open keyword.
      • If we declare a member function as abstract then we does not need to annotatate with open keyword because these are open by default.
      • An abstract member function doesn’t have a body, and it must be implemented in the derived class.
      • An abstract class can contain both abstract and non-abstract members.

Continue reading Abstract Class

Follow and like us:


A class is a blue print defined which groups functions and properties. Classes in Kotlin are defined using the keyword class followed by the class name. The body goes inside the curly braces.

Syntax of class in Kotlin

An instance of the class is instantiated in the following way

instance of the class

Contrary to Java, new isn’t a keyword in Kotlin.

new is not a keyword

Continue reading Class

Follow and like us:

Visibility Modifiers

A visibility modifier (a.k.a access modifiers or access specifiers) is a concept not tied to any specific programming language. It is a language keyword that precedes a declaration and defines the scope from where it is visible -thus can be accessed. Visibility Modifiers are modifiers that when appended to a class, interface, property or function in Kotlin, would define where all it is visible and from where all it can be accessed. The setters of properties in Kotlin can have a separate modifier from the property. There are four visibility modifiers in Kotlin

      • private
      • protected
      • internal
      • public

Continue reading Visibility Modifiers

Follow and like us:

Default And Named Arguments

In most programming language, we must specify all the arguments that a function accepts while calling that function. In Kotlin, we have a feature using which we can get rid of this constraint. We can make parameter optional while calling the function. i.e. we may pass or not pass while an argument while calling function. 

Continue reading Default And Named Arguments

Follow and like us:


Every Kotlin program has at least one function main(). However, you can define any number of functions in your program until memory is not full. It’s always a good practice to divide the whole program into smaller functions that are logically similar. It makes program more readable, understandable and debuggable.

A function declaration is done using the fun keyword.

The basic syntax of a function in Kotlin looks like this:

Syntax of for loop

Continue reading Functions

Follow and like us: