What is Kotlin ?
Kotlin is a
cross platform statically
typed, general-purpose programming language.
Kotlin is designed to
interoperability fully with java language.
Kotlin code is more
concise in terms of syntax.
Kotlin is an open source
programming language.
Kotlin is a combination
of functional and object oriented programming features.
Kotlin is widely used
for Android application development.
Kotlin mainly targets the JVM (Java Virtual Machine) but also compiles to JavaScript or
native code.
Kotlin is sponsored by Jet Brains and Google, through the
Kotlin Foundation.
Kotlin was born with the idea of covering those gaps Java
leaves and add much more simplicity to the code saving us from writing as much
boilerplate code as possible.
Kotlin is sponsored by
Google, announced as one of the official languages for Android Development in 2017.
History Of Kotlin :
Kotlin was developed by
Jet Brains team. A project was started in 2010 to developed the language for own
uses. Kotlin was developed under the Apache 2.0 license.
Kotlin is a programming
language introduced by Jet Brains , the official designer of the most intelligent
Java IDE named IntelliJ IDEA.
In 2017, Google announced Kotlin is an official language for Android Development.
Features of Kotlin Language :
There are following
features of Kotlin language :
Statically typed : It does not require you to
explicitly specify the type of every variable you declare. statically- typed
programming language, which makes you able to catch errors at compile-time, as Statically typed programming languages do type checking at compile-time.
Data Classes : Data class Student(var name : String ,
var roll : Int) It works as a model class in Java .
Lightweight : Kotlin library is small
compared to others.
Compatibility : Its compatible with JDK 1.6 and latest.
Performance : Its same as like java.
Interoperability : As we know that Kotlin runs on JVM so it is totally interoperable
with java. We can easily access the java code from Kotlin application and vice
versa.
Compilation Time : There’s a little overhead on clean builds but it’s way faster with
incremental builds.
Functional and Object Oriented : Kotlin provide a rich of built function or methods , lambda
expression, lazy evaluation,
operator overloading and many more.
Null Safe : It provides the safety from most annoying and irritating NullPointerExceptions by supporting null ability as part of its system.
Every variable in Kotlin is non-null by default like below :
String data = "Hello World"
If we try to assign
null value then it gives compile time error.So,
data = null // compile time error
To assign null value to any string then it should be declared as null able.
String
d? = null // compile successfully
Note length() function also disabled on the null able strings.
Reduce Code efforts :It also reduce the code efforts of developer in order to
other object oriented programming language.
Tools for Kotlin :
There are various platform for Kotlin language where you can develop your Kotlin applications :
1. Eclipse Ide
2. Intellij IDEA Ide
3. Android Studio Ide
|
|
|
Following
steps helps you to create and run a new Kotlin project in Eclipse IDE.
As we know that Kotlin runs on JVM so we must have JDK 1.8
or above in our machine and set the path in your system environment variable.
Step 1 : JDK Installation and Setup Path
Step 2 : IDE Installation after installation you need to open eclipse in you machine and go to help menu and select eclipse market place like below :
Step 3 : Search Kotlin plugin and install it like below :
Step 4 : Accept the license and finish it like below :
Step 5 : After finish it will restart IDE so restart the IDE after restart the IDE you need to go File -> New -> Other.. -> Kotlin Project click next like below :
Step 6 : After this you need to provide a Kotlin project name and finish it. After finish you can see your project is created in eclipse then you need to click right and create a Kotlin File and then click on next button and after next button you need to provide a name of file then finish like below :
Following
steps helps you to create and run a new Kotlin project in Android Studio IDE.
Firstly you need to download Android studio from below link :
https://developer.android.com/studio
After download and install Android Studio you need to open Android Studio then you will like below :
Now select Start a new Android Studio Project then it will look like below :
Now select Empty Activity then click on next button :
Now give the name of your application and select language Kotlin then click on finish button :
After this run this application on your Android Virtual Device or Real Device then you will get output like below :
Now its all about Kotlin IDE setup.
No comments:
Post a Comment