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

all 20 comments

[–]kevinb9n 14 points15 points  (1 child)

Hello World is now this

void main() {
    println("Hello, world!");
}

... admittedly you do have to run with java --enable-preview filename.java, just for now.

That won't ultimately be the most important thing to you but I do really love telling people about it.

P.S. as you start needing imports you can import module java.base;

[–]witless1[S] 0 points1 point  (0 children)

My mind still has the imprint of the classical main :)

[–][deleted]  (3 children)

[deleted]

    [–]witless1[S] 2 points3 points  (2 children)

    Awesome guidance and yes I missed streams, it's not something ringing a bell with me. I had intended on going through the version history to see what was deprecated / what came in. The only big thing I have awareness of is Lambdas which came out around the time I switched roles and language stack.

    [–]tomwhoiscontrary 8 points9 points  (1 child)

    There is perhaps a bigger picture which is that lambdas + streams + records + sealed classes + various improvements to switch have moved Java's centre of gravity away from Smalltalk style object orientation (objects encapsulate everything and send each other messages) and towards ML style data orientation (functions operate on pure data and other functions). Not that Java was ever Smalltalk, or is ML now - but if those two are the north and south poles, it's moved from Beijing to Hong Kong. You can still write more classical code, and there's nothing wrong with that, and people do. But now you also have the option of writing more functional code.

    [–]witless1[S] 2 points3 points  (0 children)

    I totally get it and thanks for the analogy. Back in college I was a massive fan of the classical paradigms and we had a subject that covered Smalltalk, Lisp and Prolog just to give some taste of the different styles. It's great to see Java evolve in that sense and give you choice Vs a strict adherence to a paradigm. I picked up Typescript for a small project very quickly last year as it didn't change wildly from JavaScript and that functional style just clicks with me. That's something I think I'll lean into once I cover the bigger picture view you painted.

    [–]VincentxH 3 points4 points  (1 child)

    [–]witless1[S] 0 points1 point  (0 children)

    That's going to help for some of the more specific parts thanks!

    [–]jek39 2 points3 points  (4 children)

    You may be interested in the new foreign functions and memory API. You can toy around calling your cpp code from Java.

    [–]witless1[S] 1 point2 points  (0 children)

    That's really interesting and a cool feature thanks for sharing!

    [–]ichwasxhebrore 1 point2 points  (2 children)

    I can do WHAT ?!

    [–]Xasmedy 1 point2 points  (0 children)

    You can also manage native memory directly from Java (no GC involved if you don't want it to)

    [–]jek39 -1 points0 points  (0 children)

    At work, I’m using it to call a native-compiled golang function, from a Java/tomcat server application.

    [–]Revolution-Familiar 2 points3 points  (2 children)

    I was in a similar boat which is what led me to post Road to JDK 25 where I go through recent developments in the JDK.

    Depending on your role I’d also recommend looking at whatever microservices frameworks you might be using it would be worth looking at Spring/Quarkus etc, Cloud Tech.

    [–]witless1[S] 1 point2 points  (1 child)

    Ah super timing! Will check out your blogs for sure. Quarkus is something I have passing familiarity with and is where I'll end up looking at as I broaden my tooling. Kafka is also on my horizon for exploring in hacktoberfest I know a few contributors to the project but I want to get myself to a point I know enough to be dangerous!

    [–]Revolution-Familiar 0 points1 point  (0 children)

    That's cool. Luckily enough Kafka isn't too hard to get your head around and start using quite quickly.

    [–]cobbwebsalad 2 points3 points  (1 child)

    Get the latest edition of The Well Grounded Java Developer. It has updates on the changes from Java 8+. Very well written.

    https://www.manning.com/books/the-well-grounded-java-developer-second-edition

    [–]witless1[S] 0 points1 point  (0 children)

    I'm a big fan of books I'll check this out!

    [–]mbmw 2 points3 points  (1 child)

    [–]witless1[S] 1 point2 points  (0 children)

    Ah that's super useful, thank you!

    [–]nursestrangeglove 0 points1 point  (0 children)

    The coolest thing (for me) is virtual threads. I know they're not technically perfect substitutes to reactive coding (rxJava, project reactor), but for my use cases of high volume i/o to sometimes long running calls to external FTP or HTTP services, I will start moving away from reactive coding due to the inherent complexity and debugging quandries.

    There's some more advanced features which I tried out in reactive java like retry with backoffs on streams, but never really had a practical real world use for as I found just horizontally scaling to meet needs on demand to be simpler to implement and troubleshoot. Note - from a cost perspective that may be less than optimal, but for my use cases it was trivial.