Java's Hello World Is About To Change Forever

  Рет қаралды 189,602

Coding with John

Coding with John

Күн бұрын

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

Пікірлер: 603
@CodingWithJohn
@CodingWithJohn 11 ай бұрын
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 11 ай бұрын
it's 1:47
@aaf2011
@aaf2011 11 ай бұрын
2:06
@CodingWithJohn
@CodingWithJohn 11 ай бұрын
@@whiteraven9544 🏆
@cleitonsantoia
@cleitonsantoia 11 ай бұрын
Well, sooo old school that looks like C
@MarkSmith-vo1vn
@MarkSmith-vo1vn 11 ай бұрын
@@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 11 ай бұрын
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 9 ай бұрын
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 8 ай бұрын
​@@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 6 ай бұрын
@@kam1234554321Java is used for serious projects with millions loc. A world you don‘t seem to know but where Java rules.
@glaze4629
@glaze4629 11 ай бұрын
Java 21 is a new reason for companies to stay at Java 8 xD
@JW-jd6sn
@JW-jd6sn 11 ай бұрын
yea, when they start using it in 20 years. Most big banks still use Java 8.
@glaze4629
@glaze4629 11 ай бұрын
@@JW-jd6sn I really like Java and Spring boot, but this is really sad to be honest
@Gandhi_Physique
@Gandhi_Physique 11 ай бұрын
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 11 ай бұрын
Same with IDEs also. You must have a backup of your 10 yr old IDE installer.
@AnthonyBerlin
@AnthonyBerlin 11 ай бұрын
​@@Gandhi_Physique My guess is something along the lines of "it isnt proper OOP".
@mikes333
@mikes333 11 ай бұрын
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 11 ай бұрын
I choose Java over Python is it right move in 2023
@mikes333
@mikes333 11 ай бұрын
@@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 11 ай бұрын
@@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 11 ай бұрын
​@@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 11 ай бұрын
@@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 10 ай бұрын
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 :)
@mushduxa2141
@mushduxa2141 11 ай бұрын
Java slightly morths into Kotlin
@chibitoodles5351
@chibitoodles5351 11 ай бұрын
its morthin' time
@bsdooby
@bsdooby 11 ай бұрын
more morths into Groovy 😅
@gljames24
@gljames24 11 ай бұрын
Watch out! I'm morthin' here!
@totalmonkeyspeed260
@totalmonkeyspeed260 11 ай бұрын
Riph and Morthy
@LuneAgent
@LuneAgent 11 ай бұрын
norths?
@LuneAgent
@LuneAgent 11 ай бұрын
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 11 ай бұрын
At first it might seem overwhelming if you're a newbie But that's syntax makes allot of sense
@georgeshalvashvili6270
@georgeshalvashvili6270 11 ай бұрын
Your comment contains so much boilerplate
@_caracalla_
@_caracalla_ 11 ай бұрын
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 11 ай бұрын
@@_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 11 ай бұрын
​@@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 😂
@RobRoss
@RobRoss 11 ай бұрын
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 11 ай бұрын
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 11 ай бұрын
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 9 ай бұрын
@@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 9 ай бұрын
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.
@sooxpix
@sooxpix 11 ай бұрын
I am a one year old java student and I like the old java way because it is precise. no ambiguity.
@gerdsfargen6687
@gerdsfargen6687 11 ай бұрын
Gees I tell you they're starting earlier in life now 😮
@vikingthedude
@vikingthedude 11 ай бұрын
Damn i started when i was 2 and i thought i was ambitious
@KhoaNguyen96
@KhoaNguyen96 11 ай бұрын
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 11 ай бұрын
​@@vikingthedudenaah dude, programmers nowadays start practicing when they're still in the womb
@akosbalazs7208
@akosbalazs7208 11 ай бұрын
@@KhoaNguyen96 for (int i = 0; i
@juvi925
@juvi925 11 ай бұрын
Wasn't aware of these new upcoming features. thanks for the updates John! awesome content as usual.
@nicoleta8964
@nicoleta8964 11 ай бұрын
Dude... Public static void main (String [] args) was the hug at the start of what could be a hell of an algorithm...
@phoenixflames6019
@phoenixflames6019 10 ай бұрын
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...
@gabucarneiro
@gabucarneiro 11 ай бұрын
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 10 ай бұрын
I would at least preserve the class construct. It actually is the basic building block of Java
@conorcleary733
@conorcleary733 8 ай бұрын
@@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.
@darksalmon
@darksalmon 11 ай бұрын
This will be a big help in whiteboarding leetcode during interviews!
@goobies_channel
@goobies_channel 11 ай бұрын
It looks so much better, I love it! Thank God they did something with that "string args"! Good video :D
@philippetrov4881
@philippetrov4881 11 ай бұрын
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.
@pdlbackup
@pdlbackup 11 ай бұрын
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.
@DerSchakal523
@DerSchakal523 11 ай бұрын
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! 👍🏼
@WhereMyTeeth
@WhereMyTeeth 11 ай бұрын
This is a great addition and glad to see Java is modernizing the language.
@elohimalves
@elohimalves 11 ай бұрын
This feature will make the interoperability with Kotlin devs easier.
@restagner99
@restagner99 11 ай бұрын
Nice!! Java is finally catching up with Groovy. The syntax you demonstrated is valid syntax for Groovy.
@armajroy
@armajroy 11 ай бұрын
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?
@rubens_cube
@rubens_cube 11 ай бұрын
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 11 ай бұрын
I was wondering the same!
@iCybqr
@iCybqr 11 ай бұрын
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 11 ай бұрын
@@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 11 ай бұрын
@@elohimalves ah, thanks for the clarification.
@vinterskugge907
@vinterskugge907 11 ай бұрын
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.
@renatzkigab2616
@renatzkigab2616 10 ай бұрын
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.
@bluebon5228
@bluebon5228 11 ай бұрын
What , i just started learning it
@Metanabolix
@Metanabolix 11 ай бұрын
you should stick to java 17 for now
@fredcomms_
@fredcomms_ 11 ай бұрын
Same wth man
@Anathrax
@Anathrax 11 ай бұрын
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
@antoniushka
@antoniushka 11 ай бұрын
Amazing update is coming! Just now when I've started to learn Java 😅😎👍 Great video! Keep it up 💪
@Kiyuja
@Kiyuja 11 ай бұрын
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
@realtorozan
@realtorozan 11 ай бұрын
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?
@sebon11
@sebon11 11 ай бұрын
Nice, great presentation!
@anuragbisht1200
@anuragbisht1200 4 ай бұрын
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 ?
@libertyimobi8313
@libertyimobi8313 11 ай бұрын
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 11 ай бұрын
Eh, most frameworks abstracted most of it away already anyway
@atlgansahinulasan4031
@atlgansahinulasan4031 11 ай бұрын
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 :)
@SUMITYADAV-cy9hf
@SUMITYADAV-cy9hf 3 ай бұрын
hey John !!! amazing work requesting you to create a spring framework course as well .
@CoffeeDev350
@CoffeeDev350 11 ай бұрын
Thank you John!
@_caracalla_
@_caracalla_ 11 ай бұрын
these changes will make java much more simpler to learn. amazing!
@chiter200
@chiter200 11 ай бұрын
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
@chigozie123
@chigozie123 11 ай бұрын
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.
@dejanpavkovic
@dejanpavkovic 11 ай бұрын
Thanks John!
@Amitkumar-dv1kk
@Amitkumar-dv1kk 10 ай бұрын
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 11 ай бұрын
Thank you John.
@sekharsamanta6266
@sekharsamanta6266 11 ай бұрын
always learning something new from this gentleman
@Crusader4633
@Crusader4633 11 ай бұрын
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 11 ай бұрын
we write all of this by hand in college. ALL. public class Test {} ... and so on.
@wilmarbarrick3194
@wilmarbarrick3194 11 ай бұрын
@@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 11 ай бұрын
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.
@gopalkannan4934
@gopalkannan4934 5 ай бұрын
Thanks John.
@thomi100
@thomi100 11 ай бұрын
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.
@caittastic
@caittastic 11 ай бұрын
im so excited. this is awesome
@tommylongschlong3646
@tommylongschlong3646 9 ай бұрын
Have you done a video on what people really need to know for their first Java development job?
@a7mdbest15
@a7mdbest15 3 ай бұрын
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
@dominikmeszaros9857
@dominikmeszaros9857 11 ай бұрын
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.
@doncrandalljr1425
@doncrandalljr1425 10 ай бұрын
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.
@rodrigomarques1633
@rodrigomarques1633 11 ай бұрын
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.
@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'.
@TheUkuleleTim
@TheUkuleleTim 11 ай бұрын
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?
@anonplayerssss7819
@anonplayerssss7819 11 ай бұрын
I have been doing extensive c# projects this year, for my internship I will do java, so this change is sweet :)
@andrewdecatus5172
@andrewdecatus5172 11 ай бұрын
As a python and R programmer thanks for this video. Java has always been intimidating to me because of the syntax
@experiment0003
@experiment0003 11 ай бұрын
if Java is intimidating, don't try C.
@skyknight2011
@skyknight2011 11 ай бұрын
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
@marcom.
@marcom. 11 ай бұрын
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.
@ioannischristou2362
@ioannischristou2362 11 ай бұрын
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.
@mahendramannem4407
@mahendramannem4407 11 ай бұрын
It's amazing Mr. John
@JimShingler
@JimShingler 5 ай бұрын
I have been working with java for a long time, ... it overwhelms me too!
@DoFliesCallUsWalks
@DoFliesCallUsWalks 2 ай бұрын
OMG Isaac's binding.
@patriciocornejo6180
@patriciocornejo6180 11 ай бұрын
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!
@Yunyopern
@Yunyopern 11 ай бұрын
I never learned the main method syntax by memory I always use auto complete but I think this is great.
@user-mx1ek4sl2m
@user-mx1ek4sl2m 11 ай бұрын
I know this by memory and I never wrote Java last 10 years. Only some in highschool.
@69k_gold
@69k_gold 11 ай бұрын
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?
@SalivatingSteve
@SalivatingSteve 11 ай бұрын
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.
@Utub-qc2cz
@Utub-qc2cz 11 ай бұрын
public static void main() is what makes Java worth of learn and work with.
@mariobisignani4477
@mariobisignani4477 11 ай бұрын
Don't really understand the big advantage... so we can save a couple of lines of code?
@simonrozendal7542
@simonrozendal7542 11 ай бұрын
But all of it let say the class and main method declaration is already autmaticly be done when you click in you IDE new class > "give it a name" > select generate main method? I used that always. Works the same as generate automatic getters and setters for your variables.
@joshjackson5274
@joshjackson5274 11 ай бұрын
In the financial sector, Java 8 and spring/spring boot are used loads and it doesn’t seem to be going anywhere. Java’s lifeline for the future from my perspective is making it easier and more beneficial to switch to newer Java versions rather than these long standing Java 8 systems being migrated to another language entirely. Either way, these big systems still have little to no incentive to stop using Java 8 for the near future.
@prodevcafe
@prodevcafe 10 ай бұрын
Most of fintechs I know are now using 11.
@techwizpc4484
@techwizpc4484 10 ай бұрын
Now Java really needs to have a decent GUI editor like Visual Studio.
@rishiraj2548
@rishiraj2548 11 ай бұрын
Thank you
@callmeowen
@callmeowen 11 ай бұрын
This is why I’m still on Java 8
@SleePokeR
@SleePokeR 11 ай бұрын
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)
@gbh1998
@gbh1998 11 ай бұрын
Hi John, how about discussion of most important design patterns? Like abstract factory, builder, prototype etc
@yetanothergamedevchannel
@yetanothergamedevchannel 11 ай бұрын
The compiler could treat the method as if it was the standard public static void main string args thing Then when you run it, you don't have to type in --enable-preview
@StephenSheridanOnline
@StephenSheridanOnline 11 ай бұрын
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.
@VuLinhAssassin
@VuLinhAssassin 8 ай бұрын
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");
@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. :)
@user-oh8go6mn6b
@user-oh8go6mn6b 11 ай бұрын
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…
@wisnu6374
@wisnu6374 11 ай бұрын
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
@mminahid9662
@mminahid9662 10 ай бұрын
in javaFX Application is an abstract class. In this abstract class there have some abstract methods which are overridden in main class which extends abstract Application class and also have static launch() method in abstract class Application. The launch() method calls from the main method in main class. Now how is it possible launch() method calls these abstract methods and for these calls overridden methods in main class are executes? please help to understand
@steigerph
@steigerph 11 ай бұрын
I tried but but first caught this error: release version 21 not supported, then I saw there is a javapath under common files\oracle folder, I replaced the java and javac with the preview version
@rossdev
@rossdev 10 ай бұрын
Very nice presentation thank you! While this is certainly welcome for students learning Java, it really is a fairly minor detail. They will still struggle with other aspects of the language, e.g. the concept of System (class) and out (object)…and also why some abstractions used to simplify input don’t use objects e.g. EasyIn.getInt(). In my own experience I find the biggest challenge students have is learning how to write algorithms and decompose non trivial problems into smaller parts.
@TwstedTV
@TwstedTV 11 ай бұрын
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. 😋👍
@chudchadanstud
@chudchadanstud 11 ай бұрын
--awesome --preview
@dilipsunar99
@dilipsunar99 11 ай бұрын
Awesomeeee🤩🤩
@Bliss467
@Bliss467 11 ай бұрын
I wonder why Java and c# restrict top level functions and variables to the main file? I’ve always hated wrapping public static methods and fields in a static class for no reason.
@user-oh3rg4bk1c
@user-oh3rg4bk1c 9 ай бұрын
It would be great if you can explain how to run different JDK versions without deleting the path in the environment variables. For now, I have different projects with different JDK versions, I am deleting and editing the JDK path everytime for the project I am running.
@kushalshukla12
@kushalshukla12 11 ай бұрын
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 11 ай бұрын
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.
@mikhailmakeev9515
@mikhailmakeev9515 11 ай бұрын
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" )))
@redcrafterlppa303
@redcrafterlppa303 11 ай бұрын
The problem is that most teachers and textbooks are stuck at java 8 and the new programmers will still learn the old school way. Like we still learn to write List l = new ArrayList(); Even though the second Long is completely unnecessary since a long time.
@ioannischristou2362
@ioannischristou2362 11 ай бұрын
This is about generics, which were introduced in JDK5, not 8. Also, the second Long became unnecessary in JDK7 (if not earlier), not 8. Personally, I haven't seen any book with the example you mention; if a book had this example, I'm sure the author would put it there only for "pedantic" reasons, thinking it makes it easier for his audience to understand the statement.
@redcrafterlppa303
@redcrafterlppa303 11 ай бұрын
@@ioannischristou2362 yes, but I talk about 8 as it's the most widespread version even today (wich is terrible). I also said the Long was unnecessary for a long time, not since Java 8. Hack the reference solution in our statewide exams declare variables in functions all at the top of the function. Which was never a requirement in Java and is not a requirement anymore since I think C98.
@FrostSpike
@FrostSpike 11 ай бұрын
I've been using Groovy, in its various incarnations, for over a decade, and you don't even have to have a main() method, it just runs wraps your code in a pseudo class and puts it into a main() method all transparently. It's very nice and I recommend it all Java programmers. Here's the Groovy version: println "Hello world!"
@inakiarias7465
@inakiarias7465 11 ай бұрын
Same on C#, surprised they didn't go all the way and kept the void main
@appleturdpie
@appleturdpie 11 ай бұрын
I think this is a great change for beginners. Me encountering the old hello world syntax is part of the reason, while still to this day, I do not write any Java. Along side other issues with Java; interpreted languages being annoying and heavily forcing OOP. KZbin says I'm making the 256th comment, How humorous.
@AliImtiazKhan
@AliImtiazKhan 11 ай бұрын
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 11 ай бұрын
I'll check out the stuff specifically in 17 and see if anything looks good!
@enriquepasa
@enriquepasa 11 ай бұрын
Every PL has to evolve eventually, at least at some point to not become obsolete. But at any rate, any productive change is welcome
@japhethjay4880
@japhethjay4880 11 ай бұрын
Yeah why does it still have the System.out.println(), I want this out how about just println is that too hard to do?
@haltsmaul.
@haltsmaul. 11 ай бұрын
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 11 ай бұрын
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.
@muscovitagamer
@muscovitagamer 11 ай бұрын
This reminds a lot of C, if it gets to the coming update, will really be awesome!
@bendono
@bendono 11 ай бұрын
These changes are nearly identical those introduced in C# a few years ago.
@jongeduard
@jongeduard 11 ай бұрын
Yep, of course! This kind of change was to be expected. C# got toplevel code very recently. Now Java is on turn and does a comparable step. Both languages are continuously following each other with innovations. Although I am more a C# developer than a Java developer, I learned Java earlier and I still look back at it at certain moments.
Java's Creators Rejected Multiple Inheritance - Here's Why
13:14
Coding with John
Рет қаралды 66 М.
Vectors in Java: The 1 Situation You Might Want To Use Them
16:13
Coding with John
Рет қаралды 75 М.
Sigma Girl Education #sigma #viral #comedy
00:16
CRAZY GREAPA
Рет қаралды 68 МЛН
Eccentric clown jack #short #angel #clown
00:33
Super Beauty team
Рет қаралды 19 МЛН
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 71 МЛН
Java 21 new feature: Virtual Threads #RoadTo21
33:35
Java
Рет қаралды 54 М.
Java 22 is FINALLY HERE! And I love it!
4:24
Soitio
Рет қаралды 1,4 М.
15 crazy new JS framework features you don’t know yet
6:11
Fireship
Рет қаралды 392 М.
Lambda Expressions in Java - Full Simple Tutorial
13:05
Coding with John
Рет қаралды 695 М.
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 487 М.
GPA Calculator Congressional App Challenge 2023
0:59
Dominick Ninh
Рет қаралды 305
How I Memorized ALL IntelliJ Shortcuts Effortlessly
4:55
Coding with John
Рет қаралды 42 М.
How the haters saved my game
9:00
samyam
Рет қаралды 11 М.
Sigma Girl Education #sigma #viral #comedy
00:16
CRAZY GREAPA
Рет қаралды 68 МЛН