Hello Java 22: Summary Java Day London 2024!

My first trip after I arriving in Dublin was to London, UK, to attend Java Day – Oracle.

I was very excited to attend this event because I have been using Java for 10 years, and my first course to YouTube was: Crud AdminFaces, where I used Java + JSF.

I could saw some news about the Java language, and I will share the main updates.

Oracle JDK Relases

  • In the image below, we can see the forecast for the next releases:

Java is for BIG and SMALL projects

  • This statement is polemic, I know, because there are many bad opinions about Java projects.
  • Usually, people say Java is for BIG projects, but nowadays Java has improved a lot, and we can use it for SMALL projects too.
  • I heard this several times from the architects at Oracle:

Java is for small projects too!  

 

New Hello World (JEP 445)

  • With the rise of JavaScript, we saw how simple it was to create something.
  • However, Java took a while to meet this requirement, but finally, the language embraced simplicity.
  • Now it’s really easy to write the famous “Hello world” with the JEP 445 (joined in release 21)
void main() {
  println("Hello!")
}
  • It’s important  to mention the news in JEP 286, where ‘var’ was introduced.
var list = new ArrayList<String>();
  • I’m sharing this example because after Java 8, I noticed many improvements in the language.
  • Java is elegant and powerful.

 

String Templates (JEP 430)

  • FINALLY!
  • I have been using StringBuilder for a long time, and now, String Templates were added in release 21!
var firstName = "Karan";
var lastName = "Alves Pereira";
var fullName = STR. "FullName is \{ firstName } \{ lastName }" ;
  • I admit I was a little frustrated because we need to put: STR. before we write.
  • Compare the same example with Javascript:
var firstName = "Karan";
var lastName = "Alves Pereira";
var fullName = `FullName is ${firstName} ${lastName}`
  • Isn’t perfect, but I liked 🙂

 

Sealed Classes (JEP 409)

  • I love this feature because now we can restrict which other classes may extend or implement interfaces.
  • Now we can have more control using polymorphism.
sealed interface Shape permits Circle, Rectangle {...}
  • This feature was instroduced in release 17.

 

What to expect from the future with Java?

By Geordes Saab, Senior Vice President Oracle:

  • New features and innovation on a regular.
  • Rich ecosystem of libraries and frameworks.
  • Access to powerful tools for development and runtime support.
  • These all work together and support you no matter where you are on the spectrum of pace of change.
  • You can choose the pace of change that is appropriate for your organization and your use case.

 

Conclusion

  • Java is for small and big projects.
  • I haven’t seen any programming language evolve as much as Java has in the last 10 years.
  • To those who say, “Java is slow”. Go update yourself!
  • I noticed the problem with JavaScript in projects (lack of rules). Then I saw the creation of TypeScript introducing RULES.
  • It’s interesting because when I discovered TypeScript, I saw a flexible copy of Java.
  • TypeScript was inspired by Java and now Java inspired by Javascript.
  • That’s the power of evolution!

One comment

Leave a Reply