Fireship · @fireship

Java is mounting a huge comeback

Uploaded June 5, 2023 · Length 3:40

Java is mounting a huge comeback

Summary

Java is getting new features like unnamed classes and string templates, making it more accessible to beginners and potentially more interesting to use.

  • java comeback
  • java features
  • programming language
  • java vs python
  • java vs kotlin
  • enterprise software

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    it is June 5th 2023 and you're watching

  2. 0:03

    the code report Java is hands down my

  3. 0:05

    all-time favorite programming language

  4. 0:07

    to make fun of python developers roast

  5. 0:09

    it for having so much boilerplate see

  6. 0:11

    developers laugh at absurd class names

  7. 0:12

    like abstract Factory manager Singleton

  8. 0:15

    service manager Factory C plus plus

  9. 0:17

    developers hate that you can't blow your

  10. 0:18

    legs off with memory management as

  11. 0:19

    easily and JavaScript developers are

  12. 0:21

    still trying to fix things like dates

  13. 0:23

    they copied from java over 20 years ago

  14. 0:25

    unfortunately I have some bad news

  15. 0:26

    public static void main string arcs will

  16. 0:29

    no longer be a requirement to write

  17. 0:30

    hello world in Java 21 rendering an

  18. 0:32

    entire industry of java boilerplate

  19. 0:34

    memes static null and void and that's

  20. 0:36

    not good for people like me who make a

  21. 0:37

    living making fun of java because I need

  22. 0:39

    that boilerplate to put food on my

  23. 0:40

    family it's great news however for

  24. 0:42

    anyone who wants to learn Java or more

  25. 0:44

    accurately anyone who's forced to learn

  26. 0:45

    Java this new feature is called unnamed

  27. 0:47

    classes and instant main methods and

  28. 0:49

    allows you to create a main method

  29. 0:51

    without a class and public static void

  30. 0:52

    mainstream arcs this is a great change

  31. 0:54

    but I think we could actually make

  32. 0:55

    things a little bit better by also

  33. 0:57

    removing void and actually why do we

  34. 0:58

    even need a main function in the first

  35. 0:59

    place we could get rid of that

  36. 1:01

    altogether system out seems a little

  37. 1:03

    unnecessary there should just be a

  38. 1:04

    global print line function and if we

  39. 1:06

    rename it to print we then get a perfect

  40. 1:07

    language c-sharp introduced top level

  41. 1:09

    statements in 2020 and maybe in another

  42. 1:11

    10 years Java will get there too before

  43. 1:13

    you get too excited though this feature

  44. 1:14

    is primarily designed to make learning

  45. 1:16

    Java more accessible to beginners the

  46. 1:18

    real boilerplate is not going anywhere

  47. 1:20

    in addition Java is primarily used in

  48. 1:22

    Enterprise which is very slow to adopt

  49. 1:24

    new features there are tons of mission

  50. 1:25

    critical applications out there still

  51. 1:27

    running Java 8 and it could be years or

  52. 1:28

    even decades before these new features

  53. 1:30

    get adopted but Java 21 also has some

  54. 1:32

    other cool updates like structured

  55. 1:34

    concurrency that allows you to run

  56. 1:36

    multiple concurrent jobs on multiple

  57. 1:37

    threads while treating them as a single

  58. 1:39

    unit of work but another thing you might

  59. 1:41

    find kind of crazy about Java is that it

  60. 1:43

    doesn't natively support string

  61. 1:44

    interpolation which means you need to

  62. 1:45

    concatenate a bunch of strings together

  63. 1:47

    like you're in kindergarten or use

  64. 1:48

    string.format which is also kind of

  65. 1:50

    annoying but in Java 21 we have a new

  66. 1:52

    string templates feature which is a new

  67. 1:54

    kind of expression that allows you to

  68. 1:56

    insert values directly into Strings

  69. 1:57

    we've come full circle to where Java is

  70. 1:59

    now looking more like JavaScript and