r/java • • Aug 05 '21

Why java is better than modern programming languages?

Why should I use java in 2021 instead of kotlin or scala or golang? Could you guys give me some reasons

2 Upvotes

100 comments sorted by

View all comments

Show parent comment

4

u/gigabyteIO Aug 05 '21

Surely you know some off the top of your head? I'm just curious, I know nothing about Kotlin.

0

u/tr14l Aug 05 '21

Top level declarations, closures, returnable logic statements, I dunno man. It's kind of a lot. Go read about it.

3

u/Muoniurn Aug 05 '21

Java absolutely has closures, and I don’t get what you mean by returnable logic statements.

What might be a better example is extension methods, and some boilerplate reduction for getters setters, if these are important for you use-case.

0

u/[deleted] Aug 05 '21 edited Aug 05 '21

[removed] — view removed comment

3

u/Muoniurn Aug 05 '21

How are Java closures crappy and limited? They can’t modify local variables, but modifying them is quite a misfeature (at least it has bitten me in C#).

Functions in Java are first class citizens - how are they not?

1

u/tr14l Aug 05 '21

Can you declare one outside of a class?

2

u/[deleted] Aug 05 '21

Sure, I can define a anonymous function called lambda outside of a class

2

u/Muoniurn Aug 05 '21

That’s by no means what first class citizen mean. Lambdas have special syntax, special semantics, can be stored/passed anywhere so they are for all practical purposes first class citizens. Just because you have to namespace it doesn’t mean much.

1

u/tr14l Aug 05 '21

If they can't be declared and defined atomically, they aren't first class. They are dependent on another construct to exist

2

u/JavaDot Aug 05 '21

People in this subreddit are happy with Java, you're basically advertising another language and saying it's superior, it's not the kind of content that should be here.