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 Жыл бұрын
it's 1:47
@aaf2011 Жыл бұрын
2:06
@CodingWithJohn Жыл бұрын
@@whiteraven9544 🏆
@cleitonsantoia Жыл бұрын
Well, sooo old school that looks like C
@MarkSmith-vo1vn Жыл бұрын
@@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 Жыл бұрын
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 Жыл бұрын
They are copying kotlin since they are getting replaced by it.
@jm.101 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
@@kam1234554321Java is used for serious projects with millions loc. A world you don‘t seem to know but where Java rules.
@toby99993 ай бұрын
Microsoft wanted to improve Java by adding and/or modifying features and incorporating the language into the Visual Studio suite. But they hit a legal brick wall, which ultimately led to the development of C# and .NET. Both are better than their Java counterparts in my opinion.
@mikes333 Жыл бұрын
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 Жыл бұрын
I choose Java over Python is it right move in 2023
@mikes333 Жыл бұрын
@@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 Жыл бұрын
@@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 Жыл бұрын
@@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.
@TimeConvolution Жыл бұрын
@@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
@glaze4629 Жыл бұрын
Java 21 is a new reason for companies to stay at Java 8 xD
@JW-jd6sn Жыл бұрын
yea, when they start using it in 20 years. Most big banks still use Java 8.
@glaze4629 Жыл бұрын
@@JW-jd6sn I really like Java and Spring boot, but this is really sad to be honest
@Gandhi_Physique Жыл бұрын
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 Жыл бұрын
Same with IDEs also. You must have a backup of your 10 yr old IDE installer.
@AnthonyBerlin Жыл бұрын
@@Gandhi_Physique My guess is something along the lines of "it isnt proper OOP".
@archiewood4610 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
At first it might seem overwhelming if you're a newbie But that's syntax makes allot of sense
@georgeshalvashvili6270 Жыл бұрын
Your comment contains so much boilerplate
@_caracalla_ Жыл бұрын
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 Жыл бұрын
@@_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 Жыл бұрын
@@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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
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.
@duxa03 Жыл бұрын
Java slightly morths into Kotlin
@chibitoodles5351 Жыл бұрын
its morthin' time
@bsdooby Жыл бұрын
more morths into Groovy 😅
@gljames24 Жыл бұрын
Watch out! I'm morthin' here!
@totalmonkeyspeed260 Жыл бұрын
Riph and Morthy
@LuneAgent Жыл бұрын
norths?
@sooxpix Жыл бұрын
I am a one year old java student and I like the old java way because it is precise. no ambiguity.
@gerdsfargen6687 Жыл бұрын
Gees I tell you they're starting earlier in life now 😮
@vikingthedude Жыл бұрын
Damn i started when i was 2 and i thought i was ambitious
@KhoaNguyen96 Жыл бұрын
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 Жыл бұрын
@@vikingthedudenaah dude, programmers nowadays start practicing when they're still in the womb
@akosbalazs7208 Жыл бұрын
@@KhoaNguyen96 for (int i = 0; i
@tombenjamin2164 Жыл бұрын
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 Жыл бұрын
I would at least preserve the class construct. It actually is the basic building block of Java
@conorcleary733 Жыл бұрын
@@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 Жыл бұрын
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...
@nicoleta8964 Жыл бұрын
Dude... Public static void main (String [] args) was the hug at the start of what could be a hell of an algorithm...
@darksalmon Жыл бұрын
This will be a big help in whiteboarding leetcode during interviews!
@rubens_cube Жыл бұрын
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 Жыл бұрын
I was wondering the same!
@iCybqr Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
@@elohimalves ah, thanks for the clarification.
@vinterskugge907 Жыл бұрын
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.
@philippetrov4881 Жыл бұрын
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 Жыл бұрын
This feature will make the interoperability with Kotlin devs easier.
@chigozie123 Жыл бұрын
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.
@restagner99 Жыл бұрын
Nice!! Java is finally catching up with Groovy. The syntax you demonstrated is valid syntax for Groovy.
@rodrigomarques1633 Жыл бұрын
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.
@Ewig_Luftenglanz Жыл бұрын
@@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.
@mariobisignani4477 Жыл бұрын
Don't really understand the big advantage... so we can save a couple of lines of code?
@gabucarneiro Жыл бұрын
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! 😂
@DerSchakal523 Жыл бұрын
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! 👍🏼
@Kiyuja Жыл бұрын
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
@SteveRowe Жыл бұрын
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.
@marcom. Жыл бұрын
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.
@AliImtiazKhan Жыл бұрын
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 Жыл бұрын
I'll check out the stuff specifically in 17 and see if anything looks good!
@Amitkumar-dv1kk Жыл бұрын
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.
@chiterathestore Жыл бұрын
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
@joshjackson5274 Жыл бұрын
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 Жыл бұрын
Most of fintechs I know are now using 11.
@kushalshukla12 Жыл бұрын
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 Жыл бұрын
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.
@techwizpc4484 Жыл бұрын
Now Java really needs to have a decent GUI editor like Visual Studio.
@bluebon5228 Жыл бұрын
What , i just started learning it
@Metanabolix Жыл бұрын
you should stick to java 17 for now
@fredcomms_ Жыл бұрын
Same wth man
@Anathrax Жыл бұрын
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
@呀咧呀咧 Жыл бұрын
No matter how Java updates, companies / college courses still use Java 8.
@69k_gold Жыл бұрын
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?
@skyknight2011 Жыл бұрын
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
@raylopez99 Жыл бұрын
Didn't they do the same thing in C# console mode? I think a few years ago they did and sure enough I see there's a new convention for C#.
@idontknowanygoodnames1498 Жыл бұрын
they did the same thing for c# a while back... i still use the old method, and i feel a lot of people who already use java will probably continue to do it the old way as well
@doncrandalljr1425 Жыл бұрын
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.
@WhereMyTeeth Жыл бұрын
This is a great addition and glad to see Java is modernizing the language.
@simonrozendal7542 Жыл бұрын
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.
@kumar29nov Жыл бұрын
I don't like how Java has evolved following populist opinions, despite its verbosity it had a explicit structure that you can debug, now you need to know a lot of things and are implicit, and can't just reference
@iknowtoomuch Жыл бұрын
I'll just keep doing it old school
@stephanieezat-panah7750 Жыл бұрын
I like an "enclosing parent class" myself. thanks
@troeteimarsch Жыл бұрын
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. :)
@juvi925 Жыл бұрын
Wasn't aware of these new upcoming features. thanks for the updates John! awesome content as usual.
@12MrRetro Жыл бұрын
I have one question. Why? At that moment, when you realize all disadvantages of static methods you start using only classes, or sigltones. And those unnamed class, seems, just create hiden static class, with static method, just like in kotlin. And you, just, will be again, create classes and methods, as usual... If you don't whant create classes, you need to change language to rust, or some functional (as i see, in go you will need classes, to, for best practices))
@japhethjay4880 Жыл бұрын
Yeah why does it still have the System.out.println(), I want this out how about just println is that too hard to do?
@humphreychiu Жыл бұрын
As a very experienced Java dev, this is of no value to me. However I can see it being less intimidating for total newbies. But anyone serious about learning the language will soon have to understand things like static.
@chh4516 Жыл бұрын
I can't get over this feeling that it is a "meh" feature. When I code in Kotlin - that is just better overall. And when I code in Java I rarely ever see the main function
@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.
@redcrafterlppa303 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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.
@tonywayne29 Жыл бұрын
Good for beginners. But enterprise code wants to be more verbose. IDEs handle this anyways. Just write main and space+alt and we get a main method. Does not make a huge difference. Also there is just one mainethod in a huge application. So nothing huge.
@StephenSheridanOnline Жыл бұрын
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.
@ioannischristou2362 Жыл бұрын
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.
@MetalLegacy3411 ай бұрын
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
@Yunyopern Жыл бұрын
I never learned the main method syntax by memory I always use auto complete but I think this is great.
@ΣτάθηςΣταθόπουλος-σ7ρ Жыл бұрын
I know this by memory and I never wrote Java last 10 years. Only some in highschool.
@andrewdecatus5172 Жыл бұрын
As a python and R programmer thanks for this video. Java has always been intimidating to me because of the syntax
@experiment0003 Жыл бұрын
if Java is intimidating, don't try C.
@TheUkuleleTim Жыл бұрын
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?
@anuragbisht120011 ай бұрын
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 ?
@FrostSpike Жыл бұрын
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 Жыл бұрын
Same on C#, surprised they didn't go all the way and kept the void main
@pdlbackup Жыл бұрын
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.
@jabuci Жыл бұрын
Hello World is simpler, but compiling/running is so complicated that I will stick to the class version. Thank you, Java!
@Grovion Жыл бұрын
It won't be once it's no longer in preview
@Crusader4633 Жыл бұрын
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 Жыл бұрын
we write all of this by hand in college. ALL. public class Test {} ... and so on.
@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 Жыл бұрын
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.
@RomanWeisman18 күн бұрын
Thanks, was missing the preview features in order for it to compile and run.
@dono42 Жыл бұрын
These changes are nearly identical those introduced in C# a few years ago.
@kayintong Жыл бұрын
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.
@livingcodex9878 Жыл бұрын
Imo, omitting public and static doesn't feel right since these keywords actually described what the main function is. I don't think the gain of omitting two keywords is enough to convince me that this change was necessary. I do quite like the option to omit the String[] args though. It feels natural when you don't care about the arguments. Having a classless function feels really out of order. In Kotlin that's fine because it's a completely different language and it can do some things differently, but having this change after so long in Java just feels weird. Also, what exactly is the benefit besides saving a total of two lines in a project? Templates exist and the main class and function are usually auto-generated by an IDE. A simple class definition takes only five seconds to write, so there isn't really a significant time difference either. It can be a nice gimmick for beginners, but nothing more than that imo.
@badhombre4942 Жыл бұрын
Since you only need this method once, this is such a lifesaver. /s
@siddu41 Жыл бұрын
@CodingWithJohn the course fee for Java is too high for Indian students. See if you can have customized pricing based on country.
@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
@bellum_7997 Жыл бұрын
Almost as good as C# top level statement
@wisnu6374 Жыл бұрын
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
@realtorozan Жыл бұрын
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?
@Fractal227 Жыл бұрын
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.
@renatzkigab2616 Жыл бұрын
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.
@thomi100 Жыл бұрын
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.
@stefumies7 ай бұрын
The Graal and Oracle JVM 22 compilers still complain this is a preview feature, so even with 22 this has to be set as a preview feature
@steigerph Жыл бұрын
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
@armajroy Жыл бұрын
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?
@dans.8198 Жыл бұрын
Nice. Slowly getting there. In Java-99 they’ll finally realize pointers can actually be useful in a programming language.
@kevin_mitchell5 ай бұрын
... and structs
@TheBitKrieger Жыл бұрын
I get the idea but making stuff easier just caters to having programmers who have no clue about what they are doing... if you want to learn java, then you have to understand OOP... java is OOP from start to finish, so once you learn just a tiny bit of java you will know what a class is and why the method is static - and if you are too lazy or feel it is too cumbersome to type the boilerplate: literally every text editor for coding has snippets... get up a "main" snippet and press one keycombo and you get all the text presented to you
@bobothecryptohobo8513 Жыл бұрын
I'm split. Traditionally, I've use "main" as an icebreaker to Jr. Devs, or even kids, who don't really know OO/Java. It provides the jumping off point for access modifiers, classes, static vs instance, return types, IDE class generation/packages and the JVM all in one line/generation without having to do anything but generate a class with main in it. It also is a good point to explain what boiler plate code is and how to get around having to pound out thousands of repetitive lines, which with me etched it all into my brain as I started in 1.4. The easier and quicker things get, the more things can be misused and the underlying practices are never learned. I guess the ultimate question would be, if you take it all out will the new generations still understand what it does when they run across the older style. That being said, I'm all for making it cleaner, more readable, and reduce keystrokes but when IDE's already give you the option to add a main (like Eclipse) what's really the benefit other than tech debt? It seems like languages are trying to become everything they aren't the last 10 or so yrs and though it's brought amazing things to Java, it's also bred some abhorrent coding practices and abuse trying to take shortcuts. I can always use other examples to teach, but I know when I first picked Java up at my first job figuring "main" out did a lot for me personally. But that's all based off not playing with it and first look so I may change my mind once I deal with 21.
@сойка-и8й Жыл бұрын
If i understood correctly you won't be able to refer the class created without className in other class is my understanding correct ??
@CodingWithJohn Жыл бұрын
Correct. Behind the scenes the class will be given the name of the file, but you can't refer to it from anywhere else.
@ertugrulghazi334 Жыл бұрын
Java needs a functional ONLY structure. OOP should be optional. Also, please just give us a smaller print method 😭😭 and a easier way to read input.
@itzdm0r3 Жыл бұрын
You can just type "sysout" and then tab complete the rest in most IDE's with auto complete.
@ertugrulghazi334 Жыл бұрын
@itzdm0r3 Yeah, true. I don't use Java anymore, I'm just complaining from way back 😂
@banatibor83 Жыл бұрын
A feature for those programmers who are afraid of characters.
@goobies_channel Жыл бұрын
It looks so much better, I love it! Thank God they did something with that "string args"! Good video :D
@CodeMasters51 Жыл бұрын
I tried but it is saying not supported
@ThaggeydheyLaa Жыл бұрын
For vs for each Static vs instance Static methods Multi threading Getters ,setters Please explain these concepts 🥺
@StephJ2Fan Жыл бұрын
Okay so how does that effect to someone who is currently learning java? Does that throw everything I am just now learning out the window? What if I still want to program the way I know how? Are they forcing the changes very soon or am i going to be able to do it the way i know and ease into the changes?
@CodingWithJohn Жыл бұрын
You can keep doing it the exact same way you learned. This is just optional!
@mikhailmakeev9515 Жыл бұрын
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" )))
@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.
@conorx3 Жыл бұрын
print function is still 17 chars long…
@CodingWithJohn Жыл бұрын
Hopefully that's the next thing in the chopping block
@Der_Yoloist Жыл бұрын
Not sure if I like it.. I made my OCA Course half a year ago and I know the compiler decentely well. Java hides lots of stuff that happens and makes the language unclear to beginners. My point is that this so called "easier" method hides even more and makes the language even more unclear. What do you think of my point?
@oliver_twistor Жыл бұрын
I think you are correct. Since newbies will eventually have to create classes, public and static methods sooner or later anyway, learning something only to have to "relearn" it another way later rarely makes things easier. I'm a huge fan of learning something the proper way directly, so I don't have to remember when to use what. I remember in school I had trouble learning short division so I stuck with doing long division, which I thought was far easier (I was born with a memory problem, so not having to keep numbers in my head helped me tremendously). When I later was learning polynomial division, I had an easier time than my classmates that had relied on short division and never bothered learning long division, because now they had to also learn a new division algorithm on top of learning the concept of polynomial division. Why use two different algorithms instead of one that works with everything?
@SXsoft99 Жыл бұрын
As a person that has been prpgraming in scripting languages for 8 years and have been fiddleing with kotlin, c#, go i just cant get how peple can be so enthusiastic about Java changes especially when most java developers dont invest into upgrading versions
@Expung3d_ Жыл бұрын
This one small change is just a drop in the bucket, won't really make the language much more beginner friendly. However, at a glance it definitely is
@aidoka2000 Жыл бұрын
ol'good main method is a trademark of java. will be sad to see it gone :)))
@patriciocornejo6180 Жыл бұрын
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!
@antoniushka Жыл бұрын
Amazing update is coming! Just now when I've started to learn Java 😅😎👍 Great video! Keep it up 💪
@Christobanistan Жыл бұрын
C# did this several years ago.
@mesonofgib Жыл бұрын
Why didn't they go the whole hog, do what C# did, and just allow you to write statements directly in a file without even needing the `main` method?
@libertyimobi8313 Жыл бұрын
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 Жыл бұрын
Eh, most frameworks abstracted most of it away already anyway