Ever since when I first started to learn Java, never did I realize that something so similar could be made. I started with Core, and Advanced and began my journey.

Java is one of the oldest and easiest languages. It has been at the top for more than two decades and it is still a very popular and widely used programming language. Being fluent in Java is a very good advantage to be able to learn new and similar languages.

Kotlin Overview:

Kotlin is a cross-platform, statically typed, general-purpose programming language with type inference. Kotlin is designed to interoperate fully with Java, and the JVM version of its standard library depends on the Java Class Library, but type inference allows its syntax to be more concise. Kotlin is a very concise language with handy mutability and immutability features.

How to create project in Kotlin:

1.Go to new project from file.

2.Choose new activity.

3.Choose kotlin language.

 How to add new Activity in Kotlin:

  1. Go to the app folder.

2. Create Activity.

The val and var keywords can be used only when the type can be inferred. Otherwise you need to declare the type.

var

var, Kotlin’s keyword representing mutable, non-final variables. Once initialized, we’re free to mutate/change the data held by the variable.

How this works:

var myVariable = 1

Variables declared as one data type and then initialized with a value of the wrong type will result in an error.

var myVariable: Int = b //ERROR! as b is a different type

There is example for var(Mutable property):

There is error on btnSigin because of mutable property of Button.

val

Val keyword works the same as the var keyword, but with one key difference, the variable is read-only/nonmutable. The use of Val is like declaring a new variable in Java with the final keyword.

For example, in Kotlin:

Whereas in Java:

lateinit

lateinit means late initialization. If you do not want to initialize a variable in the constructor instead you want to initialize it later on and if you can guarantee the initialization before using it, then declare that variable with lateinit keyword. It will not allocate memory until initialized.

Method Definitions:

Kotlin:                                            

    Java: 

Use inner class:

Intent:

Kotlin:

Java: