Hey,am a beginner in android applications development and i wanna know between Java and Kotlin which one is the most preferred language to begin with
Depence on the app really. My tip is look them up both. writes the pro’s and con’s and see if it matches with the idea u have for the app.
Kotlin is the recommended language (as of last year by Google). It’s specifically designed for Android development and it’s a really nice language; YMMV but I would use that on a new project. It’s relatively new but there are a vast amount of resources + afaik the majority of new projects are using it
Kotlin wasn’t built with Android development in mind. It was created by JetBrains (the same people behind IntelliJ IDEA, the IDE Android Studio is based on) and it was meant for normal JVM work, just like Java and Scala. But because it’s simpler and interoperable with Java, it quickly because a good alternative, until Google decided to make it a official Android development language in 2017.
Ah true, for some reason I thought they’d aimed to specifically target Android development. Afaics it’s only really used for Android stuff atm though (though it seems like everyone I know using Java who’s used it would switch if they could, but wide, deep support just isn’t quite there yet for non-Android usecases)
Google is really promoting Kotlin. I think that between the latest version of Android Studio and Jetbrains IntelliJ IDE (which are both free) you’ll be all set.
We can write android apps in any language and can run on Java virtual machine (JVM). They created Kotlin to be better than Java in every way. But JetBrains didn’t put an effort to write an entire new IDE’s from scratch. This was the reason Kotlin was made 100% interoperable with Java.
If you are an absolute beginner of Android application development, So begin with Java. Java is the base of Android development and hence, helps to get you learn the right etiquette and get your basics right.
While it may seem logical to start with Java because it was there first - I have to disagree.
There are compelling reasons to use Kotlin, especially for beginners.
- Kotlin is easier to read. For example it requires less “boilerplate” - that is code you write just to satisfy the programming language/tooling rather than the requirements of your application. Some examples are getters/setters,
toString. If you don’t those terms - good! These are things you don’t have to learn & code if you use Kotlin.
- Kotlin endorsed by Google as the programming language to use for Android. Google provides Android KTX libraries that make Android Java APIs easier to use, in more Kotlin-idiomatic ways. Many problems that Android developers had to solve themselves or by using open source libraries in the past are now solved out of the box by Android KTX.
- The open source community loves Kotlin. Many high quality libraries target Kotlin app developers (all java libraries are usable from Kotlin as well.
There are more advantages of Kotlin over Java “later on” - e.g. if you chose to look for work or contribute to the open source community or transition to other parts of the stack. But I don’t think we need to discuss them here. we can continue that discussion in another thread.
In summary I don’t see a single reason to start learning Android development with Java. Honestly none.
However it is easier to read, officially endorsed & supported and easier to learn.
So please use Kotlin.
My background: I’ve worked on mobile, in particular on Android, for 9 years. My code is running on the devices of 100s of millions of users. Of course that doesn’t make me right.
The above statements are based on that experience is all I’m trying to say.
If you are a beginner, 1st you have to know this. why few popular app migrated from java to kotlin? Check out this Apps migrated from java to kotlin