Java's Hello World Is About To Change Forever

Поділитися
Вставка
  • Опубліковано 27 чер 2024
  • Java's Hello World program is about to get a HUGE makeover.
    ☕ Complete Java course: codingwithjohn.thinkific.com/...
    Java's new JDK Version 21 is coming this September, and bringing in some amazing changes. Let's talk about the very best one here.
    Download it here: jdk.java.net/21/
    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...
    🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)
    bit.ly/3QPNGko
    📹Camera I use for recording:
    amzn.to/3wlXcmR
    🎙️Microphone I use (classy, I know):
    amzn.to/3AYGdbz
    00:00 New Hello World
    00:35 What Changed?
    04:17 How You Can Try It
    09:09 What About IDEs?
    Donate with PayPal (Thank you so much!)
    www.paypal.com/donate/?hosted...
    ☕Complete Java course:
    codingwithjohn.thinkific.com/...
    codingwithjohn.com

КОМЕНТАРІ • 601

  • @CodingWithJohn
    @CodingWithJohn  Рік тому +116

    There's about a 7-second part of this video that I had to re-record since I found while I was editing that I had totally flubbed a line. Thing is I had already trimmed my beard a little, so if you look closely it's definitely not a seamless transition. Let me know if you can see where it is.
    And let me know if you'd like to hear more about this kind of thing, new features in newer Java versions!

    • @whiteraven9544
      @whiteraven9544 Рік тому +23

      it's 1:47

    • @aaf2011
      @aaf2011 Рік тому +2

      2:06

    • @CodingWithJohn
      @CodingWithJohn  Рік тому +3

      @@whiteraven9544 🏆

    • @cleitonsantoia
      @cleitonsantoia Рік тому +2

      Well, sooo old school that looks like C

    • @MarkSmith-vo1vn
      @MarkSmith-vo1vn Рік тому +1

      @@CodingWithJohn Can you do streams in java. And its methods like flatMap, etc. There is not too many videos on it and I think it wil be cool

  • @panic_seller
    @panic_seller Рік тому +121

    Java was my first language, then I moved to C#. it's fascinating to learn that C# was inspired by Java, C# implemented the changes and now Java is learning from it's apprentice

    • @nightowl9467
      @nightowl9467 10 місяців тому

      They are copying kotlin since they are getting replaced by it.

    • @jm.101
      @jm.101 9 місяців тому

      As someone who is learning Java as my first strongly typed language, I don’t mind the extra words. Most ides will autocomplete is for you anyway. Just type psvm and then tab in IntelliJ and vs code. It’s also useful as a learner to see and expect the same structure everywhere.

    • @kam1234554321
      @kam1234554321 9 місяців тому +2

      ​@@sagnaik They didn't break the compatibility, it's just a new way to define the main method. I wish they actually broken the compatibility once in few years (mark the language features as depracated, let you fix it with new implementation, test with old tests, then rewrite tests) because keeping all of these old features of the language makes it harder to maintain and making sure it works - which makes development of the language slower and more buggy. The same way you are forced to fix all the issues when upgrading to a new major version of the library, they should force people to rewrite their implementations if they want to upgrade to a newer version. Unfortunately the core feature of java is that it's compatible ~25 years back so you only need to bump the version and start mixing your 20years old implementation with a new, fancy stuff.
      I want to see the face of 80 years old company in the future supporting their code writteen 80 years ago with a code of 3 human generations. It's would be like you had to maintain COBOL code while writing Java now.
      They will die due to lack of developers working for them when they have to fix an issue that their grandpa writte 70 years ago. Even now it's hard to find someone who wants to work with Java 6/7

    • @falklumo
      @falklumo 7 місяців тому

      @@kam1234554321Java is used for serious projects with millions loc. A world you don‘t seem to know but where Java rules.

  • @glaze4629
    @glaze4629 Рік тому +252

    Java 21 is a new reason for companies to stay at Java 8 xD

    • @JW-jd6sn
      @JW-jd6sn Рік тому +22

      yea, when they start using it in 20 years. Most big banks still use Java 8.

    • @glaze4629
      @glaze4629 Рік тому +9

      @@JW-jd6sn I really like Java and Spring boot, but this is really sad to be honest

    • @Gandhi_Physique
      @Gandhi_Physique Рік тому +16

      Why? I can't see how this is bad. As said, it will still check for the typical main method first so how is this a problem?

    • @boy_deploy
      @boy_deploy Рік тому +1

      Same with IDEs also. You must have a backup of your 10 yr old IDE installer.

    • @AnthonyBerlin
      @AnthonyBerlin Рік тому +5

      ​@@Gandhi_Physique My guess is something along the lines of "it isnt proper OOP".

  • @mikes333
    @mikes333 Рік тому +303

    As an experienced java programmer looking at this new main() method from the point of view of when I first started out, the first thing that comes to mind is "What took them so long???"
    However, looking at this new main() method from the point of view of an experienced java programmer my first thought would be, "Meh, I've been doing it this way for all these years, and I've got all my project templates that I've built up over time, I'll just keep doing it old school!"

    • @kaustubhkale6598
      @kaustubhkale6598 Рік тому

      I choose Java over Python is it right move in 2023

    • @mikes333
      @mikes333 Рік тому +12

      @@kaustubhkale6598 Personally I feel that whichever language you choose to start learning from, it's the 'basics' of understanding programming overall that's the important thing (functions, loops, conditionals, data types etc...) as you can then learn many of the other different languages as required depending on what problem you have to solve. Although Python, might be the 'new' and 'flashy' thing to learn just because it's new (and again depending on the problem being solved may be the better choice) there are still a large number of Java backend servers out there that require Java programmers to maintain.

    • @experiment0003
      @experiment0003 Рік тому +5

      @@mikes333 Agreed! If you understand the fundamentals, they're all pretty much the same. I can switch to a new language in a day or two! I started with R and python for statistics and Machine learning. In my first semester of grad school, I had to learn Java... besides having to get used to classes, psvm, and types, it took me hours to make that switch. C took the longest with wrapping my head around memory allocation and pointers. Even that only took about a few weeks, and I was writing systems-level scripts in Linux. Javascript took me 10 minutes to make the switch!

    • @jan5504
      @jan5504 Рік тому

      ​@@kaustubhkale6598depends but i have a news for you. There's a new comer programming language that uses the syntax of python but the performance is 10x faster than python so yeah maybe you want to know it.

    • @Funcijej
      @Funcijej Рік тому

      @@jan5504if you are talking about codon, that is not going to be free for professional use, so it might not be the killer recommendation you think it is

  • @archiewood4610
    @archiewood4610 11 місяців тому +17

    For me, as I have been using Java for years, the "unnecessary" keywords are a comfort. They make me feel reassured that the code i have written will work exactly how I intend it to. By removing these I feel it may make the code seem more ambiguous. That being said it does feel like a step in the right direction for Java as the language's complexity normally turns beginners away and this will help more people get to grips with the basics before moving on to the more complicated side - hopefully increasing Java's popularity. I also appreciate it is not a requirement to use the new layout so I can't complain. It seems overall to be a positive change for Java :)

  • @LuneAgent
    @LuneAgent Рік тому +72

    it sure looks better, but it was such a good reminder that the main method is public and static, and that you can pass arguments as strings that you can use right in the main method, I always liked that the entire code is detailed and self-explanatory, but it will be hidden from the beginners now, making it hard for them to grasp the basics of the language functionality

    • @sanjayKumar-sx5bv
      @sanjayKumar-sx5bv Рік тому +10

      At first it might seem overwhelming if you're a newbie
      But that's syntax makes allot of sense

    • @georgeshalvashvili6270
      @georgeshalvashvili6270 Рік тому +8

      Your comment contains so much boilerplate

    • @_caracalla_
      @_caracalla_ Рік тому +6

      quite the contrary, i think it will make much more easier for beginners to learn the language. they don't have to think about intermediate topics like functions being static or something, they will learn variables, operators etc first. this is an advantage.

    • @LuneAgent
      @LuneAgent Рік тому +5

      @@_caracalla_ what if a newbie sees an error like "cannot use non-static variables in a static context" in void main() and breaks his head over why is it working like this and why main is static if it isn't even declared as static

    • @Andrew-ss7jd
      @Andrew-ss7jd Рік тому +5

      ​@@LuneAgentIf they have any hope of becoming a programmer they will immediately google the issue and find out what's happening, overwise they were probably a lost cause anyways 😂

  • @mushduxa2141
    @mushduxa2141 Рік тому +181

    Java slightly morths into Kotlin

  • @sooxpix
    @sooxpix Рік тому +52

    I am a one year old java student and I like the old java way because it is precise. no ambiguity.

    • @gerdsfargen6687
      @gerdsfargen6687 Рік тому +27

      Gees I tell you they're starting earlier in life now 😮

    • @vikingthedude
      @vikingthedude Рік тому +4

      Damn i started when i was 2 and i thought i was ambitious

    • @KhoaNguyen96
      @KhoaNguyen96 Рік тому +6

      All hail the boilerplate driven language designed for writing verbose object oriented instant legacy code.
      Repeat after me:
      public static void main string args
      public static void main string args
      public static void main string args

    • @depressedsoul7487
      @depressedsoul7487 Рік тому +3

      ​@@vikingthedudenaah dude, programmers nowadays start practicing when they're still in the womb

    • @akosbalazs7208
      @akosbalazs7208 11 місяців тому

      @@KhoaNguyen96 for (int i = 0; i

  • @juvi925
    @juvi925 Рік тому +4

    Wasn't aware of these new upcoming features. thanks for the updates John! awesome content as usual.

  • @RobRoss
    @RobRoss Рік тому +73

    I’m not sure this one change is going to really make Java an easier language for a beginner to learn programming with. I’m a Java developer and I think it’s a fantastic language. But when people who have never programmed before ask me if they should “learn Java”, I tell them, if you really want to become a software developer, I highly recommend you start with Python first and learn some basic programming concepts there. As far as all the boiler plate in the traditional “Hello World” Java program, I actually think it’s a great teaching opportunity. It took me a very long time as a programmer to be comfortable with not knowing things. It happens to all of us, all the time. Whether it’s a new project in an unfamiliar domain, or a new library or framework, when you are starting out with it there are many things you’re not going to understand and a few things you will. That can be frustrating and stressful. Part of being a successful developer is learning to be comfortable with not knowing everything and trusting that the knowledge will come in time. I think teaching that concept to a new developer by explaining that they can ignore all the boilerplate and it will eventually become clear later on is a vital skill for them to learn.

    • @mikeoxlongdnb
      @mikeoxlongdnb Рік тому +18

      May i disagree regarding python? I observe my friend switching from python to java as a beginner. python oversiplyfies so many concepts that when people are trying to switch they are basically have to learn the same stuff again. Even if they'd prefer to stick with python, they will need to learn these more complex concepts anyway. If someone with no programming or even simple computer science knowledge wants to learn how to java i'd rather recommend to write simple procedures on some kind of BASIC or pascal just to get the understanding of simple procedures and then start to learn java. The only reason to learn python imo is when you want/need to use it.

    • @marktheunknown1829
      @marktheunknown1829 Рік тому +4

      I was 9 years old when I discovered Java through Minecraft mod creating videos. After I started watching Java tutorials and even though I didn't understand anything, I liked the language. It helped to have a basic computational and object oriented thinking. Moreover, I couldn't even touch python because that is just disgusting for me. I don't say it's a bad language, it is just something I cannot get used to. I am now 19, currently taking an IT course but beside that I am working on React projects, and recently I switched to TypeScript instead of JavaScript to get back Java-like features.
      I agree with you that it is important to be comfortable with not knowing everything. It took me a while to develop this, because I was scared of the amount of stuff I don't know, but as I am learning and I look back, that hey 3 months ago I didn't even know what this stuff was, and now I am able to build these things it is awesome!

    • @Christobanistan
      @Christobanistan 10 місяців тому

      @@mikeoxlongdnb I agree. I started with BASIC, then QuickBasic, Pascal, then C++, then C#. Each one of these languages built on the last. Python is a full featured language, but it does things in a really oddball way that doesn't let you build knowledge incrementally.
      Even internally, Python is built on the very foolish and outdated idea that everything is built into the language itself instead of the libraries. This leads to multiple, inconsistent ways of doing things that are confusing and hard to learn after the first few months.

    • @matthewwheeler469
      @matthewwheeler469 10 місяців тому

      Very well said. This was a big thing for me to come to terms with when I was learning Java. You don't have to understand everything immediately. The Hello World program is a great example of this.

  • @darksalmon
    @darksalmon Рік тому +11

    This will be a big help in whiteboarding leetcode during interviews!

  • @nicoleta8964
    @nicoleta8964 Рік тому +3

    Dude... Public static void main (String [] args) was the hug at the start of what could be a hell of an algorithm...

  • @gabucarneiro
    @gabucarneiro Рік тому +12

    John, you're amazing! The way you explain Java makes it way easier. By the way, it never bothered me since VSCode always filled that line for me! 😂

  • @tombenjamin2164
    @tombenjamin2164 Рік тому +11

    As an experienced engineer, I'd still like to have the blueprint of the object defined just for the sake of clarity of how objects manifests itself in Java and it's nice to know that the devs left the class definition as an option. The pros for me is in the memory usage as this could potentially save a lot of disk space especially while I'm noticing there is a popular trend in Java's relatively new functional paradigms. I can imagine myself writing a rest API with just a few lines using the function utility package and I think that would be phenomenal. At the same I also love Java's syntax being verbal enough to justify the behavior of it's statements.

    • @FABGIO1
      @FABGIO1 11 місяців тому +2

      I would at least preserve the class construct. It actually is the basic building block of Java

    • @conorcleary733
      @conorcleary733 9 місяців тому

      @@FABGIO1 All of the plumbing is still there and inferred by the compiler. Its just that it can be hidden now when working on single file java programs, a concept long present in modern java. Class contruct and everything is going nowhere, it all only applies to the basic use case such as this.

  • @phoenixflames6019
    @phoenixflames6019 11 місяців тому +2

    4:42 to 5:44
    Golden...
    Probably unrelated, but thank you SO MUCH for explaining what "setting an environment variable" means! I've been coding for a few years now, and this was NEVER explained! Most tutorials for downloading any software just say "do this and this" and I followed them helplessly...

  • @WhereMyTeeth
    @WhereMyTeeth Рік тому +3

    This is a great addition and glad to see Java is modernizing the language.

  • @bluebon5228
    @bluebon5228 Рік тому +7

    What , i just started learning it

    • @Metanabolix
      @Metanabolix Рік тому +5

      you should stick to java 17 for now

    • @fredcomms_
      @fredcomms_ Рік тому

      Same wth man

    • @Anathrax
      @Anathrax Рік тому +3

      That's fine, larger applications will actually still use the older syntax. It's just to keep beginners from getting overwhelmed with java boilerplate code

  • @philippetrov4881
    @philippetrov4881 Рік тому +8

    This should be discussed from didactics point of view for future introductory programming classes. This is clearly a feature for learners and not for professionals. I would be happy to discuss this with other professors.

  • @elohimalves
    @elohimalves Рік тому +34

    This feature will make the interoperability with Kotlin devs easier.

  • @DerSchakal523
    @DerSchakal523 Рік тому +2

    That's a good idea to provide the option to omit the class declaration because in the most cases, it's always the same: class is public, the name matches the file name, no extensions/implementations. I can only say: go ahead! 👍🏼

  • @goobies_channel
    @goobies_channel Рік тому

    It looks so much better, I love it! Thank God they did something with that "string args"! Good video :D

  • @pdlbackup
    @pdlbackup Рік тому +2

    Oh wow this is really interesting, when I started out it did confuse but I don't think it made me give up straight away (I gave up later though, but then got back into it after a few years).
    Changes like these are super welcome though! I bet it'll clear up some confusion for people starting out.

  • @rubens_cube
    @rubens_cube Рік тому +34

    Oh that is really interesting. I definitely remember being overly curious about what the whole "public static void main" thing meant when first learning Java (and I specifically remember the frustration when everyone told me to just forget about it for now haha)
    I have a question though, since the main method no longer needs to be static, does that mean we can do things that we previously couldn't do? Or does it just automatically treat it as being static?

    • @Zalaniar
      @Zalaniar Рік тому +2

      I was wondering the same!

    • @iCybqr
      @iCybqr Рік тому +1

      Technically, it can’t be static now, since it doesn’t belong to a class, right? If there’s a class being created anyway behind the scenes that contains this main method, I’d assume the main method is statically being called since it cannot be called by the user from other files.

    • @elohimalves
      @elohimalves Рік тому +14

      @@iCybqr In Kotlin you can write code without using classes, but behind the scenes if you inspect the .class files you'll see that the JVM treat the name of the file as the main class. The same will happen with Java to maintain interoperability with legacy code. So even if we don't see, behind the scenes the code will be there.

    • @iCybqr
      @iCybqr Рік тому

      @@elohimalves ah, thanks for the clarification.

    • @vinterskugge907
      @vinterskugge907 Рік тому +2

      It doesn't treat it as being static, what happens is that the JVM will construct an instance of the class, and then call the main method on that instance.

  • @armajroy
    @armajroy Рік тому +1

    Hi John, love your videos. I have seen many developers used a functional approach to solve programming questions with relatively low lines of code so I also started learning functional programming in Java but it is overwhelming. So in future could you release any Java functional programming videos for better understanding?

  • @restagner99
    @restagner99 Рік тому +1

    Nice!! Java is finally catching up with Groovy. The syntax you demonstrated is valid syntax for Groovy.

  • @atlgansahinulasan4031
    @atlgansahinulasan4031 Рік тому

    Hi!
    Thanks for this amazing video. The new version makes me think of the usage of interfaces and abstract classes as well as the extension and implementation features. If you could tell us about these features, I would be grateful :)

  • @realtorozan
    @realtorozan Рік тому +1

    Hi John, Are there any other changes coming with this new version and if you are planning to share a video of the new features?

  • @renatzkigab2616
    @renatzkigab2616 11 місяців тому

    Well this is a very good news John its getting back near to his grandfather's (C Language) syntax setup. Nice info John and please do tutorial playlist for beginners using this new Java 21 version. Thanks for the info John.

  • @anuragbisht1200
    @anuragbisht1200 5 місяців тому

    I am new to Java and this looks really cool. Makes the learning process much easier. I am wondering what is going on behind the scenes esp. with "Everything in java is a class". Does in the compile stage , compiler automagically adds a class to the code ?

  • @sebon11
    @sebon11 Рік тому

    Nice, great presentation!

  • @antoniushka
    @antoniushka Рік тому

    Amazing update is coming! Just now when I've started to learn Java 😅😎👍 Great video! Keep it up 💪

  • @_caracalla_
    @_caracalla_ Рік тому

    these changes will make java much more simpler to learn. amazing!

  • @Kiyuja
    @Kiyuja Рік тому +1

    I started programming with Java 4 years ago. These days I commonly use C# as it often used in the industry. In C# there are multiple ways of declaring your main method depending on what you want and I like that. However Java still has some edges over C# in friendliness, for example in C# you dont have a wrapper class for Strings that checks for isDigit or isLetter, Java has that be part of the String class. Printing and command input loops are "easier" in Java and so is debugging. Java is a very nice beginner language and this very advantage will get stronger with the shorter main method. Tho I personally would always teach new students the full version so they get a feeling for how methods work in general

  • @libertyimobi8313
    @libertyimobi8313 Рік тому +1

    Awesome content John. Its an eye opener. The Truth is lots of experience Java developer as myself will still want to stick to the old ways lolzz

    • @ndchunter5516
      @ndchunter5516 Рік тому

      Eh, most frameworks abstracted most of it away already anyway

  • @Yunyopern
    @Yunyopern Рік тому +5

    I never learned the main method syntax by memory I always use auto complete but I think this is great.

    • @user-mx1ek4sl2m
      @user-mx1ek4sl2m Рік тому +1

      I know this by memory and I never wrote Java last 10 years. Only some in highschool.

  • @DoFliesCallUsWalks
    @DoFliesCallUsWalks 3 місяці тому +1

    OMG Isaac's binding.

  • @Crusader4633
    @Crusader4633 Рік тому +5

    The complaints about boilerplate in Java are kind of silly, IMO - usually slung about by "fanboys" of other languages. When is the last time, as a professional programmer, you actually wrote, I mean hand-wrote boilerplate code? Yeah I'm guessing "I can't remember." Modern IDEs write all the boilerplate for us. But it is there to remind us that things are being done/defined/etc by said boilerplate - and we can change these things.

    • @new_moon1728
      @new_moon1728 Рік тому +1

      we write all of this by hand in college. ALL.
      public class Test {} ... and so on.

    • @wilmarbarrick3194
      @wilmarbarrick3194 Рік тому

      @@new_moon1728 go to a different college. IDEs have been doing the mundane for over 20 years now. You're better off understanding the declarations and why they're there rather than have magic code that works behind the scenes.

    • @andrewhinson4323
      @andrewhinson4323 Рік тому +2

      this change isnt for experienced "professional" programmers to benefit from, directly. Its for the new programmers, or wanting-to-be programmers. That way you dont end up being the only guy out there coding, even if you tend to be more of the leading-edge, hard-charging type. You benefit indirectly by having a more ready force of "support" programmers who are.. well lets say more "cautious" learners. When boilerplate doesn't inhibit or outright prevent their growth, they gain confidence, and pick up the material better which creates a positive feedback look. Some people need that. Others, like your self I presume, operate differently. In my experience, however, they often slip into the error of assuming that things they dont find challenging are not.

  • @SUMITYADAV-cy9hf
    @SUMITYADAV-cy9hf 4 місяці тому

    hey John !!! amazing work requesting you to create a spring framework course as well .

  • @patriciocornejo6180
    @patriciocornejo6180 Рік тому +2

    I have been using spring initializer for a while now, even for small things so not much of a deal for me. I'm more curious of the implications of this for java code estructure, is getting looser with each versión, in a really good way imo. Thanks for the vid!

  • @callmeowen
    @callmeowen Рік тому +2

    This is why I’m still on Java 8

  • @chigozie123
    @chigozie123 Рік тому +1

    It's like deja vu.
    I distinctly remember that Microsoft's version of C++ supports a void main with no args as well, and when I started coding in C++, everyone said not to use it, lol. It is nice to see it become mainstream in a non-C++ environment.

  • @sekharsamanta6266
    @sekharsamanta6266 Рік тому

    always learning something new from this gentleman

  • @rodrigomarques1633
    @rodrigomarques1633 Рік тому +23

    I've been a java programmer for 5 months and studying this language been 1 year. My honestly opinion is that this changes are amazing, there allow you to know better how Java works and when you don't know nothing about versions like 1.8, 11, 15, 17, 19 and 20, force you to begin with this new version to understand easily how the things work. This doesn't mean that you don't gonna need to know this things later, it's only to be more friendly when you are learning or showing Java to other people.

    • @davidgrajalesmirage
      @davidgrajalesmirage 6 місяців тому

      ​@@sagnaikit's the propuse of a teacher to teach and not to scare students.
      Also kotlin allows this and none can say that it's a garbage language meant to write small few lines of code software.
      Being easier and less boilerplate doesn't mean less powerful, simpler sintax doesn't mean more limitations.
      Hiding things you are not using doesn't mean those things don't exist anymore.

  • @caittastic
    @caittastic Рік тому

    im so excited. this is awesome

  • @TheUkuleleTim
    @TheUkuleleTim Рік тому +1

    Interestingly, C# got this in C# 9 (with no wrapping function, just code)... was the reason behind the change user convenience, or was it just following what other (arguably more popular) languages are doing?

  • @CoffeeDev350
    @CoffeeDev350 Рік тому

    Thank you John!

  • @thomi100
    @thomi100 Рік тому +4

    I think it's good that they are making (bigger) changes. Especially for beginners this looks great. I don't think it makes a huge difference to experienced developers, especially if your'e working with IDE's like IntelliJ or Visual Studio (Code), those structures are automatically generated.

  • @gbh1998
    @gbh1998 Рік тому

    Hi John, how about discussion of most important design patterns? Like abstract factory, builder, prototype etc

  • @andrewdecatus5172
    @andrewdecatus5172 Рік тому +2

    As a python and R programmer thanks for this video. Java has always been intimidating to me because of the syntax

  • @69k_gold
    @69k_gold Рік тому +2

    If there are multiple ways to declare the main method, and we use two or more main methods in the same file, each with a different way, what would happen?

  • @Amitkumar-dv1kk
    @Amitkumar-dv1kk 11 місяців тому

    It was overwhelming at first... But apparently over the years I've grown so much love for Java, I only ever code in it and everything else difficult to learn, c, c++, even python I didn't bother to learn... Rust is the only one that has peaked my interest in recent days, will be trying it out more.

  • @odilhonislomov8954
    @odilhonislomov8954 Рік тому

    Thank you John.

  • @mahendramannem4407
    @mahendramannem4407 Рік тому

    It's amazing Mr. John

  • @dominikmeszaros9857
    @dominikmeszaros9857 Рік тому

    In Intellij if you type 'psvm' and hit enter the whole main function is there automatically. Also if you use any IDEs the public class xy thing will be there automatically when creating a new file.

  • @JimShingler
    @JimShingler 6 місяців тому

    I have been working with java for a long time, ... it overwhelms me too!

  • @dejanpavkovic
    @dejanpavkovic Рік тому

    Thanks John!

  • @mikhailmakeev9515
    @mikhailmakeev9515 Рік тому +2

    With v.21 Java is getting closer to Kotlin !
    I believe after 10 more years Java will finally wrap "System.out.println" into just "println" )))

  • @chiter200
    @chiter200 Рік тому +4

    That is what Python for, if people want to it easy, Python to go. I went from Python and now learning Java and sure, it is hard if you compare two but that is for every different language. It was a huge curve when I understood that Python is dynamically typed and Java is statically typed but then again both have ups and downs.
    Anyway I will be most likely doing it the way I learned it in the books because this does not really speed anything up as most IDE will automatically write all these for you in the .java file anyway

  • @gopalkannan4934
    @gopalkannan4934 6 місяців тому

    Thanks John.

  • @techwizpc4484
    @techwizpc4484 11 місяців тому +1

    Now Java really needs to have a decent GUI editor like Visual Studio.

  • @tommylongschlong3646
    @tommylongschlong3646 10 місяців тому +1

    Have you done a video on what people really need to know for their first Java development job?

  • @troeteimarsch
    @troeteimarsch Рік тому +11

    When I was introduced to Java I hated it so much I quit programming. Then Python got me hooked again and now I'm programming mainly in Java for a living. :)

  • @VuLinhAssassin
    @VuLinhAssassin 9 місяців тому

    Hi John, what do you think of a syntactic sugar for one-line function by replacing curly braces by using arrow operator, like void main() -> System.out.println("Hello World");

  • @ioannischristou2362
    @ioannischristou2362 Рік тому +1

    if there is something in the hello-world program that I would like to see changed, that would be the "System.out.println()" statement, which is simply too long to write, and is something you need to write all the time, no matter how many years of experience you have (I have been programming in Java since 1999). True, the IDEs have their own short-cuts for writing it, but the clutter is always there, not just in the hello-world, but in all programs' source. You can try to import the method statically from System.out, but it's still an ugly import line, and you have to do it yourself in every class you write and uses it. In my opinion, it would have been much better if the search for the appropriate "main" were a search for the appropriate "println" instead.

  • @bendono
    @bendono Рік тому +1

    These changes are nearly identical those introduced in C# a few years ago.

  • @doncrandalljr1425
    @doncrandalljr1425 11 місяців тому +1

    For many, this change may seem a good thing. The problem now is those who do the single file simple program will likely forget how a Java class is actually structured, leading to other potential learning difficulties. That said, I also believe the use of the shortened main method signature is likely the best part. For example, String arguments are rarely used for desktop apps, and the static keyword has often thrown me for a loop (no pun intended), especially when adding methods after main in the same file.

  • @AliImtiazKhan
    @AliImtiazKhan Рік тому +6

    Are there any new and exciting topics like this to run in java 17, I recently switched to records and I am a spring developer so new topics kinda excite me.

    • @CodingWithJohn
      @CodingWithJohn  Рік тому +1

      I'll check out the stuff specifically in 17 and see if anything looks good!

  • @anonplayerssss7819
    @anonplayerssss7819 Рік тому

    I have been doing extensive c# projects this year, for my internship I will do java, so this change is sweet :)

  • @SleePokeR
    @SleePokeR Рік тому

    Does it mean that main() method does not accept args or it will accept them implicitly? If it's option number two, 100% sure will have the videos explaining the origins of args array in the code, that automagically is used without any declaration)

  • @marcom.
    @marcom. Рік тому +1

    Wow. If that really makes the difference as to whether a beginner can cope with Java, then maybe he'd better look for another job.
    But I'm pretty sure that Java 21 will also have far more exciting innovations on board.

  • @SalivatingSteve
    @SalivatingSteve Рік тому

    I think this is a good change. Simplified syntax will allow Java to better compete with other modern languages like Swift, which was designed to replace the archaic Objective-C.

  • @iknowtoomuch
    @iknowtoomuch 11 місяців тому +2

    I'll just keep doing it old school

  • @aliyuibrahim7076
    @aliyuibrahim7076 11 місяців тому

    Do you have a data structure and algorithms course?

  • @dalonsogz
    @dalonsogz 8 місяців тому

    Nice video, thanks, really interesting. I didn't know about this change.... Well, I have been coding in Java for more than 20 years and in my humble opinion, this is one step more towards an even more ambiguous coding in Java. More different ways of doing the same things writing less. The old sintaxis is there fore a reason. What is going behind the scenes really is there, and new developers will be unaware of that in the day basis. Sadly, being concise nowadays is confused with being brief. Well, I guess we expericenced programmers should not complain, and instead of that hail the new 'improvements'.

  • @banatibor83
    @banatibor83 Рік тому +2

    A feature for those programmers who are afraid of characters.

  • @jabuci
    @jabuci Рік тому +2

    Hello World is simpler, but compiling/running is so complicated that I will stick to the class version. Thank you, Java!

    • @Grovion
      @Grovion Рік тому +1

      It won't be once it's no longer in preview

  • @a7mdbest15
    @a7mdbest15 4 місяці тому

    Hey honestly, its good, specially for running small programs or trying stuff, I just remembered the old days knowing nothing of those keywords it scared me a lot😂.
    But of course once you learn all of those concepts it just makes sense what they mean and why they are there

  • @wewantthefunk73
    @wewantthefunk73 Рік тому

    Can you create another function and call it without a class declaration?

  • @SteveRowe
    @SteveRowe Рік тому +2

    Personally, having everything in a class has never bothered me, and public static void main(String args[]) is muscle-memory. So yeah, I will probably never use this feature.

  • @MetalLegacy34
    @MetalLegacy34 5 місяців тому

    I think the real victory here is the “String[] args” being optional. When I see an argument in a method declaration, I assume that argument serves a purpose and will be used. That has never been the case for me with the String[] args argument, I don’t think I’ve ever used it. Even if the argument could still be passed in, it not being in the method declaration tells someone reading the code it won’t be used. There’s an actual practical benefit to not including the “String[] args” compared to the rest which just abstracts fundamental Java concepts

  • @haltsmaul.
    @haltsmaul. Рік тому +1

    I approve of those changes.
    Though i will rarely benefit from this feature nowadays, i remember feeling overwhelmed when i was confronted with a Hello World program for the first time during a lecture.
    I wonder if Java could make methods be void by default and allow you to ommit the return type (or rather the lack thereof) or if this would lead to too many bugs.

    • @oliver_twistor
      @oliver_twistor Рік тому

      I hope that Java won't ever let people omit the void return type. That would be terrible, because as you say it would lead to bugs and misunderstandings. Newbies would then have to remember two ways to write methods, one way if it doesn't return anything (other than void) and another way if it does. At least in my own experience, I have had a far more difficult time learning dynamically typed languages than statically typed languages, precisely because I can never be really sure whether a function shouldn't return something or if it's just that someone forgot to add it to the signature.

  • @kushalshukla12
    @kushalshukla12 Рік тому +1

    Is there a way to decompile this Java class? To see if the compiler is adding the class and other attributes during compilation? How does it actually internally work

    • @r6playaray
      @r6playaray Рік тому +1

      Intellij can show you "decompiled" java class files. I believe that is the default behavior if you try to "open" a class file with that IDE.

  • @StephenSheridanOnline
    @StephenSheridanOnline Рік тому +1

    Reading back through some of the other comments is interesting. I teach semester 1 Java in an imperative way first, Objects come later for me. If you teach Objects early than this change may not make much sense.

  • @rishiraj2548
    @rishiraj2548 Рік тому

    Thank you

  • @wisnu6374
    @wisnu6374 Рік тому +1

    I think it's great, they make the code become short, when the first time i learn about Java it's make me confuse because the code is very long compare to Phyton

  • @呀咧呀咧
    @呀咧呀咧 11 місяців тому +1

    No matter how Java updates, companies / college courses still use Java 8.

  • @Utub-qc2cz
    @Utub-qc2cz Рік тому

    public static void main() is what makes Java worth of learn and work with.

  • @miguelbarrera4450
    @miguelbarrera4450 Рік тому +2

    John, you helped me pass my 2 programming subjects in my first year at Uni. I was thinking about purchasing your bootcamp and doing it during my summer vacation, but I was wondering if its a 1-time purchase or is it a yearly subscription?

  • @user-oh8go6mn6b
    @user-oh8go6mn6b Рік тому

    Thanks John, but after this, how do we declare static and non static method and other fields?? This look like much cleaner, but this make more confusing to me when declaring other variable and method, think that i have to learn java again…

  • @user-dx9of9vu8o
    @user-dx9of9vu8o Рік тому

    How long do you think it takes to know the basics of java if you have a lot of time where to start thanks your subscriber

  • @mlsanica7618
    @mlsanica7618 11 місяців тому

    i recently graduated from computer science and i regret every decision that led to that point, honestly nevermore

  • @mariobisignani4477
    @mariobisignani4477 Рік тому +2

    Don't really understand the big advantage... so we can save a couple of lines of code?

  • @amin9014
    @amin9014 Рік тому +1

    I am not sure this minor change really makes that much difference!!

  • @EdwinRebolledo
    @EdwinRebolledo 11 місяців тому

    Hey @CodingWithJohn could you please talk about Garbage collector and how works, thanks for your videos!

  • @mohsenkarimi572
    @mohsenkarimi572 Рік тому

    You don't even need to compile java files separately. You can run a single file with compile the java code on the memoty

  • @dailytech5917
    @dailytech5917 Рік тому

    which code editor do you us?

  • @dilipsunar99
    @dilipsunar99 Рік тому

    Awesomeeee🤩🤩

  • @Fractal227
    @Fractal227 11 місяців тому

    the thing that makes java great is the "boiler plate" as people call it, and instead of stuff being implicit it is explicit.
    it gives clarify, precision, makes errors visible and this is one of java's great strength in my opinion, while being syntatically fluid, insanely well structured and a lot of other stuff.
    I am not a fan of this at all, and cant imagine myself be using this "feature", if Java would ever enforce this on me i would ditch Java after being almost exclusive with it... 7+ years, as soon as i could.

  • @TwstedTV
    @TwstedTV Рік тому

    HOLY SHYTE !! Its about got damn time !! Wow. 😮👏👏👏
    When I started learning Java, I was so damn confused by the first 3 lines for over 3+ months.
    I really hope Oracle keeps simplifying Java, because they have way too much crap inside of it, and the language is in desperate need of pruning.
    I can think of so many things that they need to cut out and make the language for 2023 heading to 2024. Because you would have to type so much, just to do something simple.
    I don't know what took them so long, but I am really very happy they finally woke up and started to address this stuff. 😋👍

  • @skyknight2011
    @skyknight2011 Рік тому +2

    Huge. I loved this new feature. But I would like even more if we could also get rid of the 'System.out.[...]'. I started learning java sometime ago, but stopped when I realized I could write much less code in other languages. It felt like I spent more time typing the code than actually thinking about the program logic