Kotlin Series Chapter 2 — Convert MainActivity to Kotlin code

#Kotlin

An interesting feature the Kotlin plugin includes is the ability to convert from Java to Kotlin code. so for beginners, it will be very helpful how kotlin code looks.

So apply this just open your activity in my case I opened my MainActivity.java class and go to code — select convert java file to kotlin file that’s it. now your java code converts into kotlin successfully hurrryy….:-D and now you become familiar with the new language Kotlin!!!

The java onCreate method looks like this:


override fun onCreate(savedInstanceState: Bundle?)
{
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}