New Java Version 22 - The 3 Best New Features You'll ACTUALLY Use

Поделиться
HTML-код
  • Опубликовано: 5 июн 2024
  • 💻 Check out JetBrains IDEs here: jb.gg/JetBrains-IDEs
    Java version 22 is out now! Here are 3 new features that you can absolutely make use of as a beginner or advanced Java programmer.
    ☕ Java Course: codingwithjohn.thinkific.com/...
    Java 22 was release just a few weeks ago. Is it worth the upgrade? We'll talk about 3 new features in Java 22 that you can actually put into action in your programs TODAY.
    Learn or improve your Java by watching it being coded live!
    Hi, I'm John! I'm a Lead Java Software Engineer and I've been in the programming industry for more than a decade. I love sharing what I've learned over the years in a way that's understandable for all levels of Java learners.
    Let me know what else you'd like to see!
    Links to any stuff in this description are affiliate links, so if you buy a product through those links I may earn a small commission.
    📕 THE best book to learn Java, Effective Java by Joshua Bloch
    amzn.to/36AfdUu
    📕 One of my favorite programming books, Clean Code by Robert Martin
    amzn.to/3GTPVhf
    🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial
    www.audibletrial.com/johnclean...
    📹Camera I use for recording:
    amzn.to/3wlXcmR
    🎙️Microphone I use (classy, I know):
    amzn.to/3AYGdbz
    Donate with PayPal (Thank you so much!)
    www.paypal.com/donate/?hosted...
    ☕Complete Java course:
    codingwithjohn.thinkific.com/...
    codingwithjohn.com

Комментарии • 312

  • @terrificfrogg8377
    @terrificfrogg8377 Месяц назад +160

    The string template is amazing but having to begin with STR to make it work is just so Java

    • @CodingWithJohn
      @CodingWithJohn  Месяц назад +54

      I think it's technically needed for backward compatibility, since without it if some string literal happens to contain \{something}, it would break when they upgrade the Java version.

    • @PimPumSObaka
      @PimPumSObaka Месяц назад +16

      +++ This whole feature literally screams JAVA lol

    • @sstrenn
      @sstrenn Месяц назад +7

      Do you know why they couldn’t just put an f in front of the string, like python, to indicate a formatted string to the compiler?

    • @DinMamma002
      @DinMamma002 Месяц назад +7

      @@CodingWithJohn How is it needed for backward compatibility? "\{" is not allowed by the compiler afaik.

    • @havlli7544
      @havlli7544 Месяц назад +16

      @@CodingWithJohn It is a design decision as well, from what I could understand from their latest talks about these new features the reason is to give developers the ability to create their custom template processors that can have additional logic, they gave the example of creating a custom SQL template processor that would have sanitizing included in the template processor logic itself so you could just call SQL."query with parameters" in the database layer and not to worry about sanitizing because that will be centralized in the template processor itself. You could use it to adhere to formatting standards for the queries and greatly reduce boilerplate code. There are more use cases for sure but I cant come up with any from the top of my head :D

  • @MelHaynesJr
    @MelHaynesJr Месяц назад +209

    Java is older than many people using it, and it's amazing we are just now getting this String feature.

    • @adiveler
      @adiveler Месяц назад +23

      Yeah!
      C#, Python, and JS had this for ages!

    • @JorgetePanete
      @JorgetePanete Месяц назад +12

      Not yet, they'll be iterating on it and is now removed.

    • @boss50726
      @boss50726 Месяц назад +7

      I think java is now realizing that it will loose it's charm for new gen

    • @allwoundup3574
      @allwoundup3574 29 дней назад

      Because java is trash and was developed by a kiddie diddler

    • @noJobProgrammer
      @noJobProgrammer 27 дней назад

      @@adiveler C# is just a copy of Java, there is nothing special in it

  • @sanin3213
    @sanin3213 Месяц назад +163

    Return of the GOAT

  • @Kiyuja
    @Kiyuja Месяц назад +18

    String templates sounds good but it needs a little work I feel. This is the same concept as string interpolation in C# and its a little more friendly, you just add a $ in front of a string and then use the same braces as with the preview here like: $"part1 {insert} part2". Its quick and easy to use. The "_" is also a thing called disposables I believe and it can be really useful. I am happy to see Java catching up a little and hopefully they work on asynchronous execution in the future.

    • @nakarukatoshi
      @nakarukatoshi 12 дней назад

      The thing is that they decide to go with processors because programmers can create their custom ones, like custom HTML, YAML, JSON, SQL, ... processors that will sanitaze the variables
      I think some frameworks like Hibernate will implement different SQL sanitizer processors, and Jackson will do JSON and YAML processors for example

  • @MrXperx
    @MrXperx Месяц назад +24

    I came from a JS background to a Java project and the lack of string templating drove me nuts. I started to use String.format which isn't that bad.

    • @YouHaveTrouble
      @YouHaveTrouble Месяц назад +7

      in java 17 and up you can do "Some random string with %s format".formatted("special"); which is more convenient imo

    • @MrXperx
      @MrXperx Месяц назад

      @@YouHaveTrouble thanks. I'll try it.

  • @Sunnnix
    @Sunnnix Месяц назад +27

    For the third feature, I always used String.format because it's easier to read

  • @Okmeis
    @Okmeis Месяц назад +4

    Thank you for keeping us up to date.

  • @Mig440
    @Mig440 Месяц назад +34

    Unfortunately, the string templates feature has been removed for now from std. Lib since they want iterate on the design at bit further before releasing it to the public. Just good to be aware of.

    • @terrycrews1584
      @terrycrews1584 Месяц назад +3

      Dang, thought we will finally get rid of that pain in the ass of concatenation! 😂

    • @davidc_ac9377
      @davidc_ac9377 28 дней назад +1

      It has always been experimental in v21 and v22. It was not removed, because it was never standard.

    • @Mig440
      @Mig440 28 дней назад

      @@davidc_ac9377 true, but people might still think they can experiment with it on their own in jdk 23 and that will currently be impossible 😊

  • @FahadAyaz
    @FahadAyaz Месяц назад +13

    It's nice that Java devs are able to use these now. I feel blessed that we've not had to put up with these (and have a lot more loveliness) in Kotlin for years now. Going back to Java definitely feels like a step backwards

  • @paulthomas1052
    @paulthomas1052 Месяц назад +4

    Thanks for the great intro to Java 22. Look forward to more !

  • @boss50726
    @boss50726 Месяц назад +33

    Please make more videos John

  • @antonyrichard369
    @antonyrichard369 Месяц назад +7

    Not to compare as I love Java too .. but the string template feature is something .Net has implemented a few years back and Unix operating system has it way way long back ..
    I feel like Java is more moving towards like a scripting language like python or Java script and more of functional programming ofcourse

  • @VuLinhAssassin
    @VuLinhAssassin Месяц назад +3

    Hi Jon, your video was amazing.
    Btw, is there any remote position in your company?

  • @user-io1uc3wy7d
    @user-io1uc3wy7d Месяц назад +3

    Amazing i am learning dsa using Java and love to work on it further as well.

  • @nayankumar9113
    @nayankumar9113 Месяц назад +2

    welcome back champion. thank for such a great tutorials.

  • @rakshanch2126
    @rakshanch2126 Месяц назад +48

    best java youtuber

    • @MusabYK
      @MusabYK Месяц назад +3

      Agreed

  • @paramdholakiya8857
    @paramdholakiya8857 Месяц назад +5

    Using STR. String templates for Servlets. That's it. Thank you ORACLE gods. Writing Html in Java Servlet file has now became more easier

  • @lootster
    @lootster Месяц назад +2

    00:01 Java 22 introduces new features for developers
    01:46 Java 22 introduces unnamed variables
    03:25 Using unnamed variables in Java
    05:00 Java 22 introduces unnamed variables for unused exceptions and Lambda functions.
    06:46 Java 22 makes running multiple file Java programs from the command line easier.
    08:20 Java 22 brings multitfile program running and string templating as key features.
    10:05 Java 22 allows string templating for cleaner concatenation
    11:51 String templates simplify multi-line string manipulation

  • @MrAikien
    @MrAikien Месяц назад

    Thanks for the update 🙏. Really appreciate it 👌👍

  • @i_say_uhh
    @i_say_uhh Месяц назад +2

    String template looks so niceee

  • @paulmanuilenko7894
    @paulmanuilenko7894 Месяц назад

    Thanks a lot for the overview!

  • @dirkniblickable
    @dirkniblickable Месяц назад +1

    In lieu of chapter markers:
    * 1:43 - Unnamed variables
    * 7:03 - Compile and execute multi-file Java programs from command line
    * 9:14 - String templating (preview only)

  • @raymondorenda7385
    @raymondorenda7385 Месяц назад +5

    Good tutorial there though I rather they ought to have used $ sign instead of \ for that String variable combination. A convention in number of languages. Besides, adding \ in xml with its cousin / already in abundance will bring more confusion.

  • @vibingowsic2338
    @vibingowsic2338 Месяц назад +5

    Miss your tutorial John ❤❤

  • @rubens_cube
    @rubens_cube Месяц назад +5

    Hey John, another great video, thank you! I was wondering if you know something about Java Serialization? It is a topic I would love to see in a video, because it is very useful, but it feels like magic to me. I would love to see a good explanation of it so I know how to use it properly!

    • @alexandersagen3753
      @alexandersagen3753 7 дней назад

      Just a heads up, most do not recommend java serialization (Serializable and so on) as it has had so many extremely bad security vulnerabilities forever. The recommended solution is to serialize the objects to json or whatever format you prefer and use that. Many great extremely fast libraries for most if not all formats you could think of

  • @ilyriadjaajdairyli6352
    @ilyriadjaajdairyli6352 Месяц назад +1

    Thank you its very clear explained

  • @imohanthony
    @imohanthony 28 дней назад

    This video presentation was so cool am considering picking up java again.

  • @simulbista8846
    @simulbista8846 Месяц назад

    Great to have you back.

  • @baay81
    @baay81 Месяц назад +1

    thanks for sharing!

  • @danhoelzel5339
    @danhoelzel5339 Месяц назад

    string templates was something I was wondering if Java had about 8 months ago when I started working on an android app using java. Glad it is finally a feature.

  • @Morzelius
    @Morzelius Месяц назад +16

    I'm pretty sure they wanted to find the most uncomfortable syntax possible to do string templating. Maybe they checked how the popular languages doing that and wanted to create something that worse.

    • @manoelcamposdev
      @manoelcamposdev Месяц назад

      If it wasn’t due to the possibility to create any custom string processor you want, I would agree. But Oracle looked at other languages and included an awesome feature. For instance, you can create a JSON string processor or a SQL processor that avoids SQL injection. It’s just amazing and sometimes a simple lambda.

  • @nambipugal3329
    @nambipugal3329 Месяц назад +1

    Hi John, Eagerly waiting for more videos especially on Spring Security 🙃

  • @theroyaltygamer8436
    @theroyaltygamer8436 Месяц назад +1

    Hey john love your content please make more videos

  • @leogcavalli
    @leogcavalli Месяц назад +1

    Great content, as always

  • @omitobisam
    @omitobisam Месяц назад

    Unnamed variable seem to be idea of matching a pattern. If it does not match any pattern, then you can use an underscore. Example in F#.

  • @amilasilva7
    @amilasilva7 Месяц назад +1

    Can you make a video about : How quickly adapt to new Java features from java 8 to 11/17/21/22. (what new features we can use over legacy features.)

  • @avalagum7957
    @avalagum7957 Месяц назад +1

    If you could talk about structured concurrency and stream gatherer, that's really great.

  • @mayurlaniya5049
    @mayurlaniya5049 16 дней назад

    Awesome presentation!

  • @tanujabhatnagar
    @tanujabhatnagar 15 дней назад

    Could you please explain different types of design patterns used in java as well? and when to use which one?

  • @harshitkrvishwakarma3602
    @harshitkrvishwakarma3602 Месяц назад +1

    Java is becoming javascript but with types. I love it.

  • @CGDW2
    @CGDW2 Месяц назад +1

    Unnamed variables I will use occasionally, but String templates are really nice.
    I do sometimes use String.format() or printf() rather than concatenation, but they still feel kinda clunky in their syntax.

    • @CodingWithJohn
      @CodingWithJohn  Месяц назад +3

      Looks like it's unfortunately being removed even as a preview feature in Java 23, but hopefully to return in an even better format in a future release.

  • @VANTYCSolutions
    @VANTYCSolutions Месяц назад

    Awesome video thank you.

  • @pablocaiza.
    @pablocaiza. Месяц назад

    string template is awesome, is similar to template stirng in javscript :D

  • @PimPumSObaka
    @PimPumSObaka Месяц назад +2

    Those features are amazing, but... the '_' underscore variable discarding was in C# since 7.0 and they should definitely add more like from there :) The syntax sugar in C# makes it much much much better to use, so when java introduces something like this it interests me again in making things in Java

    • @sqlexp
      @sqlexp Месяц назад +2

      He missed the points of it, though. First, it is used to silence any "unused variable" warning (if Java has such a thing). Second, it saves the programmer from the need to come up with different distinct names for multiple unreferenced variables in the same scope.

  • @David-rz4vc
    @David-rz4vc Месяц назад

    C# has the underscore. it's useful in a try catch when u don't want to do anything with the exception

  • @ricardoid
    @ricardoid Месяц назад +1

    Great video! every Java improvement Scala has it many yeas before 😮

    • @lionelsimon7613
      @lionelsimon7613 5 дней назад

      Yes, they just are following that path after so many years. Poor java . However, Scala devolpers are taking now new languages, such as rust, Haskell.

  • @NadChel1
    @NadChel1 Месяц назад

    String templating is awesome. I was hoping for something like this for a long time. Though I wonder why they didn't go with backticks like JS with its string interpolation. STR is less appealing to my eye

  • @ukaszkiepas57
    @ukaszkiepas57 Месяц назад

    Thanks John! :)

  • @amilasilva7
    @amilasilva7 Месяц назад

    Hay love your videos on youtube. Supper easy to understand.

  • @dembro27
    @dembro27 Месяц назад

    They implemented my unreasonably favorite JavaScript feature, template literals, into Java. Finally!!!
    String.format is pretty good, though.

  • @younesdamous
    @younesdamous Месяц назад

    I watched a lot of your videos and I benefited a lot from you in Java... I am from Algeria... Thank you and I hope we meet one day

  • @flaviuvanca9289
    @flaviuvanca9289 Месяц назад

    Great video John. The new String concatenation is a game changer. The blank _ is a bit silly, but I welcome it, might be useful occasionally.

    • @alandoe6622
      @alandoe6622 Месяц назад +3

      If you come from python, you know it's useful.

    • @flaviuvanca9289
      @flaviuvanca9289 Месяц назад

      ​@alandoe6622, I'm planning to learn Python in the future so it's great to gain that extra knowledge.

  • @xtunasil0
    @xtunasil0 16 дней назад

    Java is finally catching up on basics features it was missing. About time!

  • @fizzcochito
    @fizzcochito Месяц назад +1

    Looking forward to using this once we upgrade from Java 8 in 23 years

  • @theminingpro
    @theminingpro Месяц назад

    That in string variable thing is a game changer for sure

  • @mohamedsameh3678
    @mohamedsameh3678 Месяц назад

    I'm impressed by your knowledge of Java versions! Since Java 9 there have been many new features. Would it be possible to create a concise overview of the key features introduced in Java 9 through 22? This would be a valuable resource for developers, and I believe your ability to explain complex topics makes you well-suited for this task.

  • @reyhanau50
    @reyhanau50 Месяц назад +1

    Hi John, will you start to teach us about Spring Boot material someday?

  • @ZachariBarnes
    @ZachariBarnes Месяц назад +11

    Grats on the sponsor!

  • @nithinvijay19
    @nithinvijay19 17 дней назад

    Worthful content from you as always!

  • @noodleslee4871
    @noodleslee4871 20 дней назад

    String template is lit!

  • @LucaCattaneo-xz5mu
    @LucaCattaneo-xz5mu Месяц назад

    hey John! i know this might be a strange request but i was wondering, could you please do a tutorial on RMI java server and RMI java client? i know, it's an outdated function but i went throw many tutorial and forum to find good explained code, but none of them was accurate, expetially when your code create thousand of error even in the compiling phase. if you decide to do it, could you please also cover all the commn errors and mistakes that could generate? thank you.

  • @kalvakolusubhash8832
    @kalvakolusubhash8832 13 дней назад

    Please make a video on how to load all the project classes during runtime.

  • @fifofuko1864
    @fifofuko1864 Месяц назад

    Maybe you might want to use unnamed references for constructor functions? Idk if this has any use.

  • @74LS_NE555
    @74LS_NE555 Месяц назад

    how did you get that vanity url for the video ?

  • @iparadoxg
    @iparadoxg Месяц назад

    Welcome Back John! ❤

  • @tanujabhatnagar
    @tanujabhatnagar 15 дней назад

    Could you please create a video explaining double locks, volatile and synchronized keyword? It would be really helpful 🙏🏻

  • @johnmckown1267
    @johnmckown1267 Месяц назад

    The _ and string interpolation (f strings) are in Python too.

  • @delsix1222
    @delsix1222 Месяц назад

    what's the reason for using String.format() now that string template exists?

  • @adamrigely3607
    @adamrigely3607 Месяц назад

    Wait, you create these awesome videos AND play TBOI? Now I appreciate you even more!

  • @lakrinmex8132
    @lakrinmex8132 9 дней назад

    I didn't know about triple quote making it multiline string. I just tried and it worked in the java version I currently use.
    Unrealted: Why doesn't my intellij(community edition) suggest whole lines like yours does?
    like when you typed Cat myCat it showed "= new MyCat(); tab to continue"

  • @user-xe5pk5pn2u
    @user-xe5pk5pn2u Месяц назад

    Keep uploading these awesome videos. I NEED IT.

  • @fernandosantiagovillegas6556
    @fernandosantiagovillegas6556 Месяц назад

    The first feature is the same or similar as python, so i think knowing how underscore works in java would help for understanding how it works un java. The string template also seems similar as the fstrings in python,

  • @SweetDemon11
    @SweetDemon11 18 дней назад

    John could you talk about Java Modules please, i appreciate your content

  • @advsaifkhan8938
    @advsaifkhan8938 День назад

    One thing is very good to Java that Java advances slowly but safely.

  • @zachariahtatman7381
    @zachariahtatman7381 Месяц назад +1

    wow java finally coming out with basic features that have existed in other langiuages for years. i might actuially enjoy java in 5 years.

  • @deepakyadav-ny2cj
    @deepakyadav-ny2cj Месяц назад +1

    Please increase the frequency of you appearing with new video, we really wait eagerly.

  • @ChemicalVapors
    @ChemicalVapors 5 дней назад

    The quick fix called it "STR Processor". Are there other processors? What can we do with them?

  • @wannacry6586
    @wannacry6586 13 дней назад

    Anyone know what setting enables this type of auto completion 2:03

  • @withgrowinginsanity198
    @withgrowinginsanity198 Месяц назад

    11:49 what about the existing feature "my name is %s".formatted(name);
    no STR and very confusing looking (especially inside HTML) "\" needed ...

  • @karenlim7841
    @karenlim7841 Месяц назад

    Yay, you’re back!

  • @denver3703
    @denver3703 22 дня назад

    Hello John, can you cover RegEx in java

  • @user-hn1cy5ee5l
    @user-hn1cy5ee5l Месяц назад

    regarding strings template, why just don't use f as a prefix to the string like in python? String message = f"My message is {msg}", isn't it easier? Better implement a wheel rather than look up for other approaches

  • @anne_the_dev
    @anne_the_dev Месяц назад +4

    Hi John, I'm Anne and I have been programming for almost 5 months and I'm about to learn data structures, but I'm considering switching to js since it's really hard to do so in Java + I already know HTML and CSS so is it worth the switch? And I also get a bit overwhelmed after people talking about complex stuff, so any suggestion to avoiding that? BTW thanks for the generics tutorial it was awesome ❤
    Btw I use vs code so sorry, I can't switch to jet brains.... Yet

    • @CodingWithJohn
      @CodingWithJohn  Месяц назад +4

      Ha no worries! Well I don't know if javascript is heavily used for data structures work, particularly with HTML/CSS. Together those are mostly for the front ends of websites, and not so much for data structure work behind the scenes. Between those I would stay with Java, although there are definitely other options too. The tough part will be the concepts of data structures, and probably not so much the actual language you use to implement them.
      Just get started with the simplest stuff you can understand, and work from there. Try to go step by step, implementing something very simple and let it sink in, code it yourself and mess around with it, doing a lot of testing. Then take small steps forward, making it more complex as you get more familiar.
      If you have specific topics that others might be interested in as well, let me know and you might see a video about it!

    • @anne_the_dev
      @anne_the_dev Месяц назад +1

      @@CodingWithJohn thanks you so much!!! Yeah I have a video idea: maven tutorial

    • @aravindmuthu5748
      @aravindmuthu5748 Месяц назад +2

      if you know HTML and CSS, the next logical step is to learn JS without which web development is incomplete tbh. It is better to pause your Java for now, because it could get quite confusing from J to JS. Both are drastically different languages (why did they name it JAVAscript tho???) and once you try js, all the object oriented programming gets thrown out of the window, and you'll be needing to learn functional programming, which btw is waayyyyy easier than OOP approach. Once you feel like you're comfortable with it, you can decide whether to switch back, because honestly Java is mainly used in big enterprise companies and JS is used by lean and fast teams.
      So in conclusion, you either leave out web development and concentrate on Java, it has got its long term benefits or abandon Java(for now) and concentrate on JS which will speed up your programming skills itself and you can land a job quicker...

    • @ZachariBarnes
      @ZachariBarnes Месяц назад +1

      You can do data structure work in JavaScript but JavaScript doesn't have many built in data types for handling those sorts of objects and often you'll need to pull in a npm package or write your own, which will add a lot of complexity to your programs. Stick with Java or another back-end language more suited to data structure manipulation

    • @jaybee2530
      @jaybee2530 Месяц назад +2

      A good possible alternative for Java would be C#. My first language was Java, and it can be a bit daunting to learn at first, but i'm very happy i stuck with it. It gives me a greater understanding of programming concepts than if i would have started to learn with Python for instance. Either way, whatever language you pick, learn the language thourough. Don't hop from one language to the other only learning a bit about each language, and don't worry about getting overwhelmed either. Programming can be difficult. So, take a breath, make a coffee, and take it one step at a time. Good luck!

  • @gamehacker5692
    @gamehacker5692 Месяц назад

    Can we get a video on the Java turtle functionality, I know how to use it in python but can’t get the syntax fully in Java

  • @balogunoluwatobijohn154
    @balogunoluwatobijohn154 Месяц назад

    Please can you do us the favour of doing a tutorial on random access file. Thank you

  • @justhorse3584
    @justhorse3584 6 дней назад

    Hi John,
    I would like to hear your opinion about oracle java certificate. Please help me out. I am 3 years old java developer and my next target is getting this certification. However, I am not sure if it is worth the effort in 2024. Especially with the rise of AI.

  • @DekelGilboa-pv2je
    @DekelGilboa-pv2je Месяц назад

    The string template option is already existed in 21 preview

  • @frederik_hd
    @frederik_hd Месяц назад

    unnamed variables as well as multi file compiling + executing (although I've never needed something like that and never will) i like a lot. but I don't like string templating with STR. at the beginning of the strings maybe I would like it if you can leave out the STR.

    • @adiveler
      @adiveler Месяц назад +1

      It still better than:
      "My name is " + name + "and my age is " + age;
      And than:
      "My name is %s and my age is %d", name, age;
      Also, other languages do something similar too, in C# you need to put $ before the quotes, and in Python, f.

    • @CodingWithJohn
      @CodingWithJohn  Месяц назад +1

      I assume the reasoning behind needing STR is backwards compatibility. If some existing string happens to use \{} in the string literal it would break with this change.

  • @FonPacific
    @FonPacific 15 дней назад

    While PHP moves towards Java, Java implements features PHP has been having since long time ago. I find it funny yet interesting!

  • @vanlepthien6768
    @vanlepthien6768 29 дней назад

    Wow - actually useful new features!

  • @imakhlaqXD
    @imakhlaqXD Месяц назад +1

    Java seriously need to work on its syntax make it someting like Kotline. And remove those legacy stuff and old stuff. We really need a java version with breaking changes and whole rework.

  • @user-zj6xe6ov8z
    @user-zj6xe6ov8z Месяц назад

    It took Java 22 major versions to implement Python3.6 f-string style format. Wow, that's so cool 😏

  • @Eeatch
    @Eeatch Месяц назад

    Even though i am no good programmer by any means, who failed to do most of the tasks at my coding school. I recenty finished learninig Python there, both of these features where already there when i studied. And actually were added years and years ago.
    in Python you can reference underscore use it in for loop, and the second thing where you put variables inside a string without concatanation is called an "f string".
    I know that python lacks features like JVM, and it's execution time is slow, but why java should lack f strings and underscore variables? Makes me wonder if thre are any more features that java lacks?
    I still want to learn Java though, and those two features are nice to have.
    And it appears that they already removed this .STR

  • @guilhermesoares7857
    @guilhermesoares7857 29 дней назад +1

    Not to kill the hype but the string template is on second preview and it is now unplanned for jdk 23.

  • @sadiulhakim7814
    @sadiulhakim7814 Месяц назад

    I saw one issue in StringBuilder today. I had to build string inside a while loop. Inside that loop i was creating a StringBuilder instance and creating the string. Later i wanted to make the StringBuilder outside the loop. But i was appending something in the string builder inside the loop. After appending and generating string i had to clean up the string builder for next iteration. I could not clean the string builder. I tried setLength(0), delete method. But the bytes inside value array still exists.

    • @jelmerterburg3588
      @jelmerterburg3588 3 дня назад

      What is the issue, exactly? The values of the internal char array of the StringBuilder do not matter, setLength(0) is sufficient to reset it. StringBuilder does not perform any unnecessary operations on the internal buffer.

    • @sadiulhakim7814
      @sadiulhakim7814 2 дня назад

      @@jelmerterburg3588 I am not sure but at that time setting length 0 was messing things up.

  • @akumayin3350
    @akumayin3350 Месяц назад

    most unecessary feature : unnamed variables, most useful and cool feature : String template

  • @SebBrosig
    @SebBrosig 14 дней назад

    Wow: all that convenience, almost like Perl!

  • @Toni2Go
    @Toni2Go Месяц назад

    Please do a vid about Structured Concurrency

  • @amitn10
    @amitn10 23 дня назад

    Please make a video about radix sort🙏🙏

  • @tigerstyping
    @tigerstyping Месяц назад

    Great video, but I'd make sure to caution against using template strings for HTML! If you're processing user input, you should always sanitize the values before putting them in your HTML, preferably using a trusted library.