Kotlin Now an Official Language on Android

Kotlin has been discussed in the Android development community as a potential replacement for Java. It has several advantages that make it quicker and easier to write, with less boilerplate and potential errors. It can be compiled into Java, making it possible to use on Android, although with a few workarounds.

Today, Google announced that Kotlin is coming to Android as an officially supported language. This means that there will be many more libraries, both first and third-party, that will be created. It will also make Android development easier for new developers. The language was created by JetBrains, the company who created the base of Android Studio. Kotlin has already been supported and Android Studio can quickly allow Java to be converted into the language.

In Java:

public class User {
    private String name;
    private int age;

    public User(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return this.name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getAge() {
        return this.age;
    }

    // and the methods equals, hashCode, copy, omitted for brevity
}

In Kotlin

data class User(var name: String, var age: Int)

Example from Arctouch

Google and JetBrains plan to start a non-profit organization around the language to continue encouraging development and maintain it. This will not be replacing Java. Java support will continue, and new Java 8 features were introduced in Android O.

What’s great is apps can have both Kotlin and Java and work together. In the coming months, we should expect to see many apps slowly adopt this language as needed, even if they don’t want to rewrite what they have currently.

Nick Felker

Nick Felker

Nick Felker is a student Electrical & Computer Engineering student at Rowan University (C/O 2017) and the student IEEE webmaster. When he's not studying, he is a software developer for the web and Android (Felker Tech). He has several open source projects on GitHub (http://github.com/fleker) Devices: Moto G-2013 Moto G-2015, Moto 360, Google ADT-1, Nexus 7-2013 (x2), Lenovo Laptop, Custom Desktop. Although he was an intern at Google, the content of this blog is entirely independent and his own thoughts.

More Posts - Website

Follow Me:
TwitterLinkedInGoogle PlusReddit