Kotlin – Basics

Kotlin – Basics

Hello guys !
After long time glad to meet you guys .

In now a days You may here about  kotlin with Android . Am i Right ?. Then why we don’t talk about Kotlin. so today i want to share something basic details about Kotlin, like :

(i) What is Kotlin ?

(ii) History of Kotlin

(iii) Kotlin Philosophy

(iv) Syntax of Kotlin

(v) Semantics

(vi) Hello World !


(i) What is Kotlin ?

Kotlin is a statically-typed programming language that runs on the Java Virtual Machine and also can be compiled to JavaScript source code or uses the LLVM compiler infrastructure.

Kotlin is expressive, concise, extensible, powerful, and a joy to read and write.It has wonderful safety features in terms of nullability and immutability,  which aligns with our investments to make Android apps healthy and performant by default. Best of all, it’s interoperable with our existing Android languages and runtime. So we’re thrilled to make Kotlin an official language on Android.

Its primary development is from a team of JetBrains programmers based in Saint Petersburg, Russia. While the syntax is not compatible with Java, Kotlin is designed to interoperate with Java code and is reliant on Java code from the existing Java Class Library, such as the collections framework.

” The name comes from Kotlin Island, near St. Petersburg. Andrey Breslav mentioned that the team decided to name it after an island just like Java was named after the Indonesian island of Java. “

(ii) History of Kotlin

Jetbrains was looking for a replacement for Java to use in their products. They were seeing the limitations of Java, and little perspective of  it being improved soon. Jetbrains has a big existing Java code base so rewriting everything was a no-go, so a new language needed to be Java compatible. They had a look at several JVM languages. One of their requirements was static compilation so in the end Scala was the only viable option of existing languages. They tried that, but ran into limitations of Scala such as slow compile speed (and little perspective of that being improved), and good IDE support not being possible due to the structure of the language. (Another reason you see companies move away from Scala is its complexity and Scala inviting you to write unreadable code, but I don’t know how much of a role that played for Jetbrains.)

In the end they decided to create their own Java compatible language, focused on practicality, with features that had already been proven in different languages, and superb IDE support. Many of Kotlins features are taken from other JVM languages, especially from Groovy. One of the more difficult features was the nullability in the type system. In general any feature that interacts with Java interop and does not have a
direct analogy in Java will be hard to implement in a satisfying way. For nullability, the question was what type to assign to Java methods that were used from Kotlin. At first the Kotlin designers went with assuming nullability for Java parameters and return value, but that gave too much hassle. They tried to improve that by supporting manual nullability annotations on Java APIs, and automatic inference by analyzing the bytecode, but this did not give results that were good enough. Maintaining external nullability annotations for Java APIs was too hard and time consuming, and automatic nullability inference was not accurate enough to work smoothly. In the end they came up with platform types, which is what Kotlin uses today. A similar mechanism is used for mutable/immutable collections and Java APIs.

(iii) Kotlin Philosophy

Development lead Andrey Breslav has said that Kotlin is designed to be an industrial-strength object-oriented language, and a “better language” than Java, but still be fully interoperable with Java code, allowing companies to make a gradual migration from Java to Kotlin.

(iv) Syntax of Kotlin

Kotlin variable declarations and parameter lists have the data type come after the variable name (and with a colon separator). As in Scala and Groovy, semicolons are optional as a statement terminator; in most cases a newline is sufficient for the compiler to deduce that the statement has ended.

For more about Kotlin Syntax.


(v) Semantics


In addition to the classes and methods (called member functions in Kotlin) of object-oriented programming, Kotlin also supports procedural programming with the use of functions.[12] As in C and C++, the entry point to a Kotlin program is a function named “main”, which is passed an array containing any command line arguments. Perl and Unix/Linux shell script-style string interpolation is supported. Type inference is also

For more about Kotlin Semantics .


(vi) Hello World !


fun main(args : Array<String>) {
val scope = “world”
println(“Hello, $scope!”)




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s