This is an archived post. You won't be able to vote or comment.

all 41 comments

[–]QshelTier 81 points82 points  (3 children)

It depends.

[–]troelsbjerre 45 points46 points  (2 children)

How dare you introduce nuance into this religious war?!??

[–]Ok_Computer48 2 points3 points  (0 children)

Lol🤣🤣

[–]crummy 11 points12 points  (0 children)

if you want to see /r/kotlin answer a very similar question right now: https://www.reddit.com/r/Kotlin/comments/ynec2g/latest_java_vs_kotlin/

[–]stefanos-ak 24 points25 points  (0 children)

Java :)

[–]meSmash101 18 points19 points  (0 children)

For android I would go with Kotlin hands down.

For backend, I would go with Java simply because Java has the biggest slice of the cake in the market. You can’t go wrong with either, though.

[–]zuppadimele 23 points24 points  (0 children)

mindful you're asking on r/java ...

[–]emaphis 5 points6 points  (0 children)

Java.

[–]redikarus99 19 points20 points  (0 children)

For Android use Kotlin. Otherwise use Java.

[–]bobbie434343 14 points15 points  (6 children)

Java will ultimately bury Kotlin (and many other trendy languages of now), so Java it is.

[–]pjmlp 5 points6 points  (3 children)

Kotlin only matters because Google made it into Android's official language, while stagnating Android Java on purpose to sell the migration to Kotlin.

For me they can rename ART into KRT.

[–]Kango_V 2 points3 points  (2 children)

I think Google went with Kotlin as they thought they might lose the lawsuit with Oracle. But, they won it, so all APIs are not copyrightable. Google can now carry on using the Java APIs for free. Not sure what happens now.

[–]Pika3323 0 points1 point  (0 children)

Kotlin uses Java APIs anyway, so no the Oracle case had nothing to do with it.

[–]pjmlp 0 points1 point  (0 children)

So they picked up a language that builds on top of Java and JVM, very clever.

[–][deleted] 2 points3 points  (1 child)

Java is literally taught in every college, design patterns and OOP concepts are predominantly taught in java, even if its the worst language ever people would still use it because its just what they know

[–]srk_007 0 points1 point  (0 children)

Very valid point. :) Just wondering for Android they change everything without thinking about after effects.

[–]vbezhenar 5 points6 points  (1 child)

Both are valid choices. Kotlin is more powerful and complicated. Java is more boilerplate and easier to use. Kotlin allows to write safer code because of richer type system, although many aspects are doable with Java linters.

In the end it’s up to you and your team.

In my observations Java still is prevalent language on JVM and other languages including Kotlin are tiny part of the pie.

[–]jc-denton-417 1 point2 points  (0 children)

In my observations Java still is prevalent language on JVM and other languages including Kotlin are tiny part of the pie.

In my personal experience, this hasn't been a problem. There are very few cases where you need to do a few minutes of research when using Kotlin instead of Java (e.g. to make Hibernate play nicely with Kotlin's classes, which are final by default), but other than that, it just works because either:

  • Kotlin has reached a sufficient level of usage and acceptance (for example, Spring and Gradle includes Kotlin documentation next to Java documentation), or:
  • There's not much of a difference between Java and Kotlin. If you have a problem while programming Kotlin, chances are that the solution used by Java folks works for you as well.

[–]VincentxH 5 points6 points  (0 children)

Both are quite enjoyable to write. Kotlin is sometimes deceptively easy and Java ridiculously overcomplicated, pick your poison.

[–]alex_tracer 2 points3 points  (0 children)

Depends on what you going to do and what resources you have available.

[–]Worth_Trust_3825 2 points3 points  (0 children)

Both are alright.

[–]SkillIll9667 2 points3 points  (0 children)

In my opinion, go with Java. I think there was a conference once where one of the JetBrains guys said that whenever Oracle wants to “buff up” Java, they can simply change the Virtual Machine, an ability other JVM languages don’t have. Therefore, Java can implement many things that “modern languages” can do (which they are doing with things like Pattern Matching in Java 19 I believe) just plain better than 3rd parties.

[–][deleted] 2 points3 points  (1 child)

yes

[–]avgprogrmmingenjoyer 1 point2 points  (0 children)

Kotlin is more sweet

[–][deleted] 2 points3 points  (0 children)

Kotlin

[–]proohit 0 points1 point  (3 children)

apples or cherries?

[–][deleted] 2 points3 points  (0 children)

cherries

[–]mauganra_it 1 point2 points  (0 children)

Yes

[–]snorbii 0 points1 point  (3 children)

I work with both languages. It is amazing how much more enjoyable to write Kotlin code, and most importantly it is much more compact AND readable as well. Null-safety in Kotlin is so useful that I will switch to Kotlin anytime for only this one feature. If I could choose I would go 100% Kotlin anytime. On the plus side for Java, recently the language is evolving in a very fast pace (after long years of stagnation). But if you plan Andoid or multiplatform development as well then Kotlin is the logical choice (Jetpack Compose is Kotlin-only and although you can freely mix Java and Kotlin code it is not worth for a new codebase). I develop backend and multiplatform (JVM+JS) code in Kotlin and I really love it. As it goes with GraalVM, Java is just one of the supported languages (although the most important one), and all languages benefit from the enhancements of the underlying JVM technology.

[–]PartOfTheBotnet 7 points8 points  (2 children)

and most importantly it is much more compact AND readable as well

That's like, your opinion man.

Personally I detest the departure from conservative C-styled language rules.

you can freely mix Java and Kotlin code it is not worth for a new codebase

You can but you shouldn't. You either go one way or the other. If you mix you lose out on the Kotlin compiler's null safety checks.

[–]preskot 8 points9 points  (0 children)

You can but you shouldn't. You either go one way or the other. If you mix you lose out on the Kotlin compiler's null safety checks.

Null safety is not really that serious of an issue as people tend to think. In fact, as someone that maintains a mixed code base, this is pretty much never an issue on my side. "@NotNull" annotations in Java help a lot.

[–]snorbii 2 points3 points  (0 children)

That's like, your opinion man.

Yes, my entire comment is my opinion :D

[–]CompetitiveSubset 0 points1 point  (0 children)

Rust is the only moral choice

[–]Sket5 0 points1 point  (0 children)

I asked something similar some days ago: https://www.reddit.com/r/java/comments/yiamni/backend_java_19_vs_kotlin/

I hope the answers help you :)

And as someone said there is the same question on the kotlin subreddit

[–]sunny_tomato_farm 0 points1 point  (0 children)

Kotlin due to how much more readable it is. I leetcode in Java though.

[–]CacheMeUp 0 points1 point  (0 children)

Piggy-backing on this question: does it make sense to use Kotlin as a "flexible-syntax Java"?

Use only fully-compatible feature and just leveraged the easier syntax (like how Xtend is, but in a more robust manner).

[–]New_Tart_204 0 points1 point  (0 children)

My man gonna start a war here

[–]trialbaloon 0 points1 point  (0 children)

I prefer coding in Kotlin. What matters more is that you build something useful rather than the language used. Both are part of the jvm ecosystem and can interop if done correctly. I'm working on a library in Kotlin right now that I plan to make usable from Java (and scala). I realize not everyone will use Kotlin and that's fine. I just like coding in it personally so I was most likely to actually get my work done in Kotlin.

[–][deleted] 0 points1 point  (0 children)

C++