Getting started with Kotlin


Introduction

Kotlin is a statistically written object-oriented programming language developed primarily by Jet Brains, targeting JVM (Java Virtual Machine).
Kotlin was developed to compile faster and adapt backward. It is very secure and 100% interactive with Java. Kotlin has additionally been developed; the goal is to allow a Java developer as many features as possible. Kotlin's standard compiler permits the compilation of Java bytecode and JavaScript for JVM.

Compiling Kotlin

Kotlin is a standard IDE plug-in for Eclipse and IntelliJ. Kotlin may also be collected using Maven, Ant, and Gradle or via the command line. Note that $ kotlinc Main. kt will output a Java class file, in this case, MainKt.class (Note Kt added with class name); however, if someone runs a class file with $ java MainKt.
To run the ensuing class file using Java, one should include the Kotlin runt-time jar file to Current classpath.

Versions

Versions Release date
1.0.0 15/02/2016
1.0.1 16/03/2016
1.0.2 13/05/2016
1.0.3 30/06/2016
1.0.4 22/09/2016
1.0.5 08/11/2016
1.0.6 27/12/2016
1.1.0 01/03/2017
1.1.1 14/03/2017
1.1.2 25/04/2017
1.1.3 23/06/2017
1.1.6 13/11/2017
1.2.2 17/01/2018
1.2.3 01/03/2018
1.2.4 19/04/2018

Why Kotlin?

Kotlin is very popular among programmers of all levels and is used for:

  • Cross-platform mobile applications.
  • Android application development.
  • Web application development
  • Server-side applications
  • Desktop application development
  • Data science-based applications

Kotlin runs on various platforms (Windows, Mac, Linux, Raspberry Pi, etc.) and is 100% compatible with Java. Many big companies like Google, Netflix, Slack, and Uber use Kotlin to develop Android-based applications.
Most importantly, many companies are actively looking for Kotlin developers, especially Android development.

Compiling and Running Kotlin code in Command Line

Java provides two different commands for compiling and executing Java code. The same goes for Kotlin gives entirely different commands .javac to compile java files. Java runs Java files wherever as kotlin to run kotlin files like kotlinc to compile kotlin files.

Read Input from Command-Line.

Arguments passed from the console will be retrieved and used in the Kotlin program as input. We will transfer the number of N (1 2 3 etc.) arguments from the command prompt.