Kotlin: Things to know about Android's latest development language
What is Kotlin?
Kotlin is a programming language for modern multi-platform applications, fully compatible with Android and developed by JetBrains, the company behind IntelliJ Java IDE (suite of tools and applications for developers) which Android Studio is based on. However, this is not a separate programming language but a new way to use and develop Java code. Kotlin works seamlessly with Java , which makes it easy for Java-loving developers to use an excellent programming language, Kotlin, as well as make use of more useful libraries from this language.
Like many other programming languages, Kotlin runs on Java Virtual Machine (JVM) and uses tools and libraries available on Java.
Since its introduction in 2011 until the release of version 1.0, JetBrains has always focused on compatibility with Java. So what does Kotlin have over Java? Let's go down to find out!
- Kotlin - the fastest growing programming language in the world
What does Kotlin outperform Java?
Java can be thought of as a programming language for building applications that run on almost every operating system, with all hardware. Java is extremely powerful, you can use Java to write programs that perform many different things, such as video games, technology utilities, hardware controls or anything else. It is also the main programming language for developing applications on the Android operating system.
Java is generally very complex. And Kotlin was born to 'eliminate' some cumbersome components, making the program shorter and clearer.
The main purpose of Kotlin is to inherit the good and solve the problems that Java faces. So the question "Kotlin or Java?" has appeared a lot in the Android development community since the Google I / O event when Kotlin was named in the "IDE Android" section, becoming the number 1 supported language on this operating system platform. The answer is that Kotlin's code is shorter and clearer than Java, and the files of both languages can coexist in Android applications. Therefore, Kotlin is not only useful for new applications but also extends existing Java applications.
Some advantages of Kotlin can be mentioned as:
- The code is short, minimizing unnecessary sections, short, intuitive structure, easy to learn, easy to do, easy to use, saving time. According to Ovechkin's estimate, using Kotlin, base code can be 15-25% smaller.
- Safe, avoid NullPointerException error. NullPointerException occurs when the code refers to a variable, but the variable has no value when the application is running. As a result, the application will not have any options except error reporting. And of course, with Kotlin, make sure developers won't encounter this problem.
- Highly interactive , 100% compatible and boosts the use of existing libraries in the JVM, including SAM support.
- The tool works friendly, can choose Java IDE to work or work with the command line.
All of this is why developers love Kotlin so much. Code faster, less rules and simpler than Java. You can read the code that you or others write more comfortably. Still code, but not too complicated headache.
So is Java gradually being eliminated?
Absolutely not! In any case, it is undeniable that Java is still very powerful and always maintains an important position with the latest versions of Android and Android Studio.
There have been comments somewhere that define Kotlin as a lightweight Java version. That is considered an affirmation: Kotlin 'closely resembles Java', using the Java engine to run an application on your device, but with less frustration. Kotlin needs to install Java on the phone or computer and on any other device. The need for Java is constant. And of course you can use both Kotlin and Java at the same time. Instead of "Java light", Kotlin should be better described with the phrase "Java ++".
Kotlin installation for Android development
Follow these steps:
Step 1: Open Android Studio, select File -> Settings -> Plugins.
Step 2: In the Plugin section, look at the bottom and click 'Install JetBrains plugin .'.
Step 3: Search for "Kotlin" or scroll down to the 'k' and look for "Kotlin", press the green Install button to let Studio perform the download.
Step 4: Wait for Kotlin download program.
Step 5: Now create New Activity in Android Studio and open the MainActivity.java file.
Step 6: Press Ctrl + Alt + Shift + K to display a dialog box that says 'Convert Java Files into Kotlin' and then select OK to convert Java to Kotlin.
Step 7: Succeed !!! Welcome to Kotlin with the new MainActivity.kt file.
Where to study Kotlin?
First of all, visit the JetBrains Kotlin website to know everything you need to get started.
If you're an Android developer, please visit the following websites:
- Kotlin for Android Developer
- Android Kotlin Extensions
You can use Android Studio, Eclipse, IntelliJ IDEA or standalone compiler to build Kotlin applications for Android or your web browser.
Don't be afraid to try something new! Wish you learn programming very fun!
You should read it
- How to learn Kotlin without coding experience
- Kotlin - the fastest growing programming language in the world
- Discovered a new line of malicious Android code that steals user data on the electronic application market
- In the end, big universities realized that Java was a lousy language if used for introductory programming
- What is Java? Why choose Java?
- Which career Java programming options are waiting for you?
- How to Download a Java Development Kit to Program on Android
- Download Java Development Kit 8-update-281
- JAVA test on P3
- Overview of R language, install R on Windows and Linux
- JAVA test test P1
- Basic Java exercises, with sample decoding