ANDROID DEVELOPMENT-KOTLIN VS JAVA

ANDROID DEVELOPMENTKOTLIN VS JAVA

 

Ever since Google announced Kotlin as the official language for Android development at Google IO in 2017, programmers who want to become Android developers are in a dilemma. The big question in front of them is whether they should learn Kotlin or Java.

If you are a complete beginner who wants to learn Android development, then my answer is Java, but if you are a Java developer who wants to jump into the lucrative market of Android app development, then my answer is Kotlin.

When I say beginners should start with Java, you may be thinking, “What the heck? Kotlin is much more productive, less boilerplate code, and now the official language of Android development, and this she is suggesting learning Java. I am not going fall for it…”

                                   

Beginners in Android Development Should Start With Java

 

 

If you start Android development with a well-established language like Java, you become a part of the bigger Java community and market, which directly means more job opportunities.

And more important thing is that there is a huge community of Java programmers, which means you can find answers when you are stuck. This is very important because, as a beginner, you will face a lot of technical problems and you might not know where to head when you are stuck. When you search Google with a Java problem, you are bound to get answers; the same cannot be said for Kotlin, which is still a new programming language.

There are also more tutorials, books, and courses out there, both free and paid, which can teach you Android development with Java, e.g. this list of Android resources for Java programmers, but there are not many for Kotlin, especially free resources on Android development.

 

Java Programmers Should Learn Kotlin

I think its best to learn Kotlin because it really improves productivity.

A class which takes 50 lines of code in Java can really be written in just one line in Kotlin. It can help you avoid all boiler-plate code, e.g. you don’t need to specify methods LIKE:

getters and setters, equals(), hashCode(),toString()

 Kotlin can generate all that by itself.

 

Coding for Creating Snackbar in Android Application

java kotlin
public class MainActivity extends AppCompatActivity {

 

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

setSupportActionBar(toolbar);

 

FloatingActionButton myfab = (FloatingActionButton) findViewById(R.id.myfab);

myfab.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

Snackbar.make(view, “This is a snackbar”, Snackbar.LENGTH_LONG)

.setAction(“Action”, null).show();

}

});

}

 

}

class MainActivity : AppCompatActivity() {

 

override fun onCreate(savedInstanceState: Bundle?) {

super.onCreate(savedInstanceState)

setContentView(R.layout.activity_main)

val toolbar = findViewById(R.id.toolbar) as Toolbar

setSupportActionBar(toolbar)

 

val myfab = findViewById(R.id.myfab) as FloatingActionButton

myfab.setOnClickListener { view ->

Snackbar.make(view, “This is a snackbar”, Snackbar.LENGTH_LONG)

.setAction(“Action”, null).show()

}

}

 

}

 

 

If you are Java developer, then you’d better start learning Kotlin to not only improve your productivity, but also help you become part of a lucrative niche of Java developers who know Kotlin, which may give you a competitive edge in the job market.

Hope this blog inspires you to embrace change and grow. Whether you are an XPLORER or not, feel free to glance through our blogs and help us guide and support you in your voyage to success. Happy Learning!

 

0 responses on "ANDROID DEVELOPMENT-KOTLIN VS JAVA"

Leave a Message

Your email address will not be published. Required fields are marked *

About Xplore IT Corp

XIC is home to several global certified trainers who are subject matter experts in their respective domains. XIC has Vast experienced resources who are top experts including that of Microsoft, Cisco, Oracle, VMware, Red Hat, Novell, EC Council, Adobe, among others.

top
© Xplore IT Corp 2017. All rights reserved. Designed by ProPlus Logics
Xplore WhatsApp Chat
Send via WhatsApp
X