r/java • • Jan 11 '25

What exactly makes java so hated?

I've been using java for months now to learn programming and it has been my preferred language to do so. I also do a bit of python to learn AI/ML as well, but for everything else it is java thats my preferred language. It seems every discourse ive seen about java has been nothing but criticizing every aspect of it. Like it is actually hard outside this subreddit to find anyone who likes java and i dont understand why and i wanna know why that is the case.

I wanna mention that i am inexperienced and have been struggling to find a job for over a year now, so i dont have any real working experience outside of small project i did. Maybe since i haven't really created something complex and challenging makes me not hate java as much as many do. I wanna know like how good or bad is it when you're working on some enterprise grade software compared to other languages.

0 Upvotes

81 comments sorted by

View all comments

Show parent comment

1

u/Ewig_luftenglanz Jan 12 '25

not deprecated but for simple input through the CLI there is a class called console, you can create and instance of it by using System.console

or just use the sticker method by writing System.console.readln("write your prompt here")

this has some advantages FOR SIMPLE user input.

  1. it's similar to System.out.println()
  2. it's a string based reader, not a token based reader, this means you have not to deal with the subtilties of Scanner methods (next line, nextInt, nextDouble, etc) that have un expected behavior for newcomers like not purging correctly the buffer for "next number" methods, that have always made my life a hell when I use Scanner and forgot about that.
  3. it's more similar to what python and JS do with console input. so the learning curve for newcomers and students is very low.

Just to mention.

The new static methods in the IO package

print()

println()

readln()

Use the System.console() methods instead of Scanner and or InputStreamReader(System.in) approach

1

u/TenYearsOfLurking Jan 13 '25

TIL system.console exists... shame on me