News for hackers. Stuff that matters.
Re:All New Java Language Features Since Java 21 by javanonymous on Saturday September 06, 2025 @04:12PM (#45152469)
> why would we ever want in Java to hold a variable that you can't read immediately what is the type

I can use my IDE to see the type if necessary.

> Everything that came after isn't really memorable nor helpful,

There are several improvements that are very helpful

One example is how switch statements have improved code readability, at least from my personal subjective viewpoint.

   String dayName = switch (day) {
      case 1 -> "Monday";
      case 2 -> "Tuesday";
      case 3, 4, 5 -> "Other day";
      default -> "Weekend";
   };
Re:All New Java Language Features Since Java 21 by nunobrito on Sunday September 07, 2025 @05:23AM (#45156685)
You could have as easily used String instead of var and there would be no ambiguity. This gets worse for numbers where it is important to know if you are dealing with an integer, long or something even bigger.

I agree with you on switches and do like the """ feature, thought. It was a real pain in the rear to include the multiple + "\n" back in the old days. This is a very clean and intuitive improvement.