Java Main Method Explained - What Does All That Stuff Mean?

  Рет қаралды 245,080

Coding with John

Coding with John

Күн бұрын

Пікірлер: 287
@SponkADonk
@SponkADonk 3 жыл бұрын
For whatever reason I have struggled with really understanding "static" and you just cleared it up for me. Thanks, John!
@beesetti.d.ssubhash5075
@beesetti.d.ssubhash5075 2 жыл бұрын
Can you please explain with an example. 😊
@jumpz5561
@jumpz5561 2 жыл бұрын
@@beesetti.d.ssubhash5075 if a method in a class is static, you'd need to create an instance of the class "Class1 class = new class()" in order to call the method, however if isn't static, you wouldn't need to to create the "Class1 class = new class()". You can directly call the method by writing Class1.method
@jumpz5561
@jumpz5561 2 жыл бұрын
does this make sense?
@AK-wc1cv
@AK-wc1cv 2 жыл бұрын
@@jumpz5561 Or is it the other way round
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
Yeah it's the other way around. If it's static, you can (and should) call it directly on the class without creating an object. But if it's not static, you have to create an object and call the method on the object.
@nick-yr7wu
@nick-yr7wu 2 жыл бұрын
You seriously deserve more subscribers. You are an amazing teacher, thank you John
@sabeennawaz1001
@sabeennawaz1001 2 жыл бұрын
Yes, that's why I told all of my classmates about John. We call him "Java John"
@InvinciRD
@InvinciRD Жыл бұрын
The reason why i love this channel is the explanation is just like the way it's needed and basics are at-least a bit clearer than what we know already.
@victoriagee1059
@victoriagee1059 3 жыл бұрын
0:23 no one quite says that. They just say they’ll discuss it later. Lol but you are such a good teacher. Happy I found you!
@kebbil
@kebbil 2 жыл бұрын
and never do
@nonnodacciaio704
@nonnodacciaio704 2 жыл бұрын
@@kebbil in any course you'll go over classes, methods and arguments, so you should be able to figure out what it does by yourself. Besides, they went over this in my course without even us asking
@vu5700
@vu5700 2 жыл бұрын
thats what your wife says the first time you are having sex with her
@theboss-by5gd
@theboss-by5gd 2 жыл бұрын
well ur lucky if they do.My teacher didnt say anything,she just said thats a default in java.So it really depends on the kinda teacher u hav
@pranavnyavanandi9710
@pranavnyavanandi9710 2 жыл бұрын
It's quite straightforward once you get into the language. Initially, they give a vague definition so you can go on with the learning.
@shivjyotigarai2141
@shivjyotigarai2141 Жыл бұрын
1. jre calls the public main() 2. static methods in a class can be called without creating an instance of that class. Just call MainMethodExplaination.main() 3. void because does not return anything. 4. String args[] => passing arguments as an input .
@caffeinatedpanda1511
@caffeinatedpanda1511 3 жыл бұрын
the scenario at the beginning was LITERALLY MY EXPERIENCE. tysm
@alihaydarkaya3336
@alihaydarkaya3336 2 жыл бұрын
helloJohn, sometimes I’m having a language barriers but when you explain I don’t feel that. I appreciate it great explanation.
@charityg4786
@charityg4786 3 жыл бұрын
You are so enthusiastic when you teach. thanks for the lesson,it was easy to understand
@CodingWithJohn
@CodingWithJohn 3 жыл бұрын
Very glad to hear that, thanks for watching!
@ThatOtherAndi
@ThatOtherAndi Жыл бұрын
man i just stumbled upon your channel and im simply blown away by the quality of your content, it's gold
@LaGrossePaulik
@LaGrossePaulik 2 жыл бұрын
Thank you so much!
@lastwish6428
@lastwish6428 Жыл бұрын
It feels good , when you already know all these stuff and still watching this complete video 🤗
@mishellybelly
@mishellybelly 5 ай бұрын
I just started my BA in IT but going towards the coding route with my degree and currently in my first intro to coding class at my university and I thank you for your explanations! This is all super helpful.
@michalski9141
@michalski9141 2 жыл бұрын
havent watched the video yet but: public - the accessor, means the method is accessible in other classes; static - the class doesnt need to be instantiated to be called; void - the return type, it does not return anything; main is of course the name and it takes in command line arguments represented by an array of strings called args
@boulettefranck2627
@boulettefranck2627 11 ай бұрын
Three years later, i've "super appreciated" your video ! Thx 🤩
@Galasssss
@Galasssss Жыл бұрын
Watching your videos bring me the feeling that I could talk to you drinking a beer and learning a lot of coding stuff for HOURS. You're funny and smart, and know properly what you're saying. Amazing
@jonathanbyrdmusic
@jonathanbyrdmusic 8 ай бұрын
“Args” is actually the sound I make trying to understand computer language
@Catalyst313
@Catalyst313 2 жыл бұрын
I don't wanna underrate any of your other videos but this one (especially the introduction) really got me insanely immersed
@colbyboucher6391
@colbyboucher6391 2 жыл бұрын
Might be good to note that those main args are typically used for advanced configuration options.
@michaelkennedy5126
@michaelkennedy5126 3 ай бұрын
Thank you for explaining public static void main and how to use that args array!
@spacemeat23
@spacemeat23 Жыл бұрын
this is my favorite channel for clearing up Java concepts, thank you so much John
@hexagonmagnetics569
@hexagonmagnetics569 2 жыл бұрын
The elephant in my text editor has been explained, thanks! I’ve watched a bunch of java youtubers, but you are indeed the most thorough with explaining java concepts!
@g_r_x_v
@g_r_x_v 2 жыл бұрын
I started watching your videos yesterday and I am subscribed now, very interesting explanations!
@anonimosilva6723
@anonimosilva6723 Жыл бұрын
Another clever idea: if it's an array of strings, you can also modify it to an array of integers! It works similarly! Thank you for this excential explanation!!
@yadnyeshdesai6652
@yadnyeshdesai6652 2 жыл бұрын
Hey John, you are providing a great educational value. Your videos always help to clear my doubts and understand the basics of Java. Keep it up. Thanks a lot.
@ramyareddy6190
@ramyareddy6190 2 жыл бұрын
yours the first channel i subscribed after watching many others.. you are just too good to be on you tube. I love your videos.
@rajithlahiru5580
@rajithlahiru5580 3 ай бұрын
Top 2 Teachers in You tube. The Cherno, Coding with John Thank you John!!
@mattmartin26
@mattmartin26 2 жыл бұрын
Finally, a clear, succinct, and helpful explanation!
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
Glad it was helpful!
@heetwarm7819
@heetwarm7819 3 жыл бұрын
After al those hours searching for explanations this is the only video I found helpful and entertaining! Keep it up!
@samaravadi3
@samaravadi3 Жыл бұрын
I'm studying for my theory final in a couple days and you're helping me tremendously
@mythicaldata6297
@mythicaldata6297 2 жыл бұрын
Great video, when I was taking java at university I felt they had way too many analogies, that by the end of them I was just confused and bored, and didn't answer stuff like this fully glad to heard a nice clear explanation instead of something like "you'll learn that later"
@evanmcgillivray8697
@evanmcgillivray8697 3 жыл бұрын
Thanks for the video! Great stuff man
@spancavil
@spancavil Жыл бұрын
Extremely useful! Congratz John.
@fyh8848
@fyh8848 2 жыл бұрын
Interesting, thx. Btw, the word “main” is inherited from C language. main function is entrance point in C.
@10F2C
@10F2C 2 жыл бұрын
the int main{} thingy?
@brijkumar8207
@brijkumar8207 2 жыл бұрын
Hello I have search so many videos on public static void main. But this is the first one that is clearer. You made it lot easier. You have any courses I can take?
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
Thanks! There's one linked in the description if you're interested. You can see all the content that's included and watch a few lessons free before you buy anything.
@brijkumar8207
@brijkumar8207 2 жыл бұрын
@@CodingWithJohn I already code but I get confused on how to start
@gregorriusadolphus2729
@gregorriusadolphus2729 Жыл бұрын
This was very helpful....I just started learning Java last night (I was a JavaScript guy) and this really cleared things up! Gracias!!
@saptarshidey7672
@saptarshidey7672 2 жыл бұрын
Hello John, I really like the way you teach. Absolutely great!!! On similar lines to this video, students most of the time also think about the real stuff behind System.out.println(). Can you create a video explaining each part - What is System, out, println? Also the static nature of out and thus it can be used on top of the System class directly instead of an object. Cheers
@davishek7
@davishek7 2 жыл бұрын
Neither college teachers nor the textbooks ever explained what args do. Thanks for the clear explanation.
@hexagonmagnetics569
@hexagonmagnetics569 2 жыл бұрын
I would like a big o notation lesson on search algorithms! Please discuss the space and time complexities of various algorithms and their most suitable applications!
@LanceLiebenberg
@LanceLiebenberg Жыл бұрын
Thanks so much bro. This honestly helped so much. Walking away a little more confident 👍
@gunuk123
@gunuk123 4 ай бұрын
Imagine you’re baking a cake: So, public static void main(String[] args) means: public: Anyone can use this recipe. static: You don't need to make a whole cake to read the recipe. void: The recipe itself doesn't give you cake. main: This is the name of the recipe. (String[] args): This part is like optional ingredients that you might add to the recipe.
@FREDDYMAZENGE
@FREDDYMAZENGE 2 жыл бұрын
bro this video made me subscribe without any hesitations ...... l like the way you started your video
@mahodaadikari4116
@mahodaadikari4116 2 жыл бұрын
Your explanations are amazing. Keep up the good work. Wish you all the best ❤
@albertosoto4280
@albertosoto4280 3 жыл бұрын
THANKS A LOT! People just saying "just copy this" was driving me nuts.
@CodingWithJohn
@CodingWithJohn 3 жыл бұрын
Glad it helped! When you're first getting started it can be kind of overwhelming and confusing to understand everything that's going on with it, so "just put it in there" isn't terrible advice for your very first program. But after a while it's valuable to be clear why it's all there.
@findlestick
@findlestick 3 жыл бұрын
Way to clearly explain things. Thank you. 👍
@k0.9486
@k0.9486 2 жыл бұрын
I always hate the "just do it this way" teaching method. You never really know how to work around problems, only a few steps and well.....not all problems fit within those steps. Thanks for the video series on Java, by far the best I've found on YT.
@Noah-vm8id
@Noah-vm8id 2 жыл бұрын
This was a video I was always looking for when I was a beginner, thanks 🙏
@katiescape
@katiescape 7 ай бұрын
My mind always asks me 'why' and when I can't get the answers my learning shuts down, thank you for this explanation!
@anth0ni33
@anth0ni33 2 жыл бұрын
This is a very fun and easy to understand explanation. I'm not even a java developer (learning c#) but I understood it perfectly. I've noticed java and c# share similar syntax tho.
@NitaiZohar
@NitaiZohar Жыл бұрын
Thank you a lot❤❤ you are really helpful and you are very understandable
@Affiliation2Code
@Affiliation2Code 10 ай бұрын
Starting with Java 21, the days when we have to stop enthusiastic beginners from asking questions about 'public static void main(String[] args)' because it's simply too advanced for a first lesson, are finally over. Nevertheless, great explanations, keep going!
@musicvibes1146
@musicvibes1146 2 жыл бұрын
thanks john im a 7th grader trying to learn java this video helped out a lot thanks
@JoseThomas-erpjose
@JoseThomas-erpjose 2 жыл бұрын
Wow, Never knew what it means. Super simple explaination
@Mohanadxd
@Mohanadxd 3 жыл бұрын
John you are absolutely legend
@ebenolivier2762
@ebenolivier2762 2 жыл бұрын
Interestingly, the designers of Java could have opted to return an int from the main method (instead of void) to indicate to the OS the state the program completed in e.g. success, failure etc.. You can actually specify such an int when you call System.exit to exit the program.
@fisyr
@fisyr 2 жыл бұрын
I was wondering about that. I've been learning a lot of C lately and having your main function return an exit code seems to be the standard there.
@NotreallySerious695
@NotreallySerious695 Жыл бұрын
It does return a code based on the success in Intellij IDEA I haven't tried in other IDEs so idk about others
@michaelmai25
@michaelmai25 Жыл бұрын
omg...bro is better teacher than all my professors combined lol GREAT VIDEO!
@henriquesenadev2194
@henriquesenadev2194 2 жыл бұрын
Great and simple video! Congrats and thanks
@jayshreebargohil
@jayshreebargohil 2 жыл бұрын
Most dramatic version of you in this video 😀
@valoriebroderick
@valoriebroderick Жыл бұрын
It would be awesome if you could do a video just on the static keyword. Why would you use it besides in the main method and stuff.
@furkancakin1553
@furkancakin1553 3 жыл бұрын
Hi John !!! I have been following you and watching alllll of your Java tutorials all the time would love to meet one day if you are anywhere near east coast !! I realized in this video though you are very quiet 😊 are you trying to to not wake someone up at home ??!! 😛 you are great thank you so much for al the useful info ! I hope the best for you
@MrSajjadgul
@MrSajjadgul 3 жыл бұрын
A must like from me for all of your videos.
@steveymcsteve0717
@steveymcsteve0717 3 жыл бұрын
Thank you for this. I was always wondering what it all did and I could never geta good answer.
@shwetaadhikari7403
@shwetaadhikari7403 Жыл бұрын
The bottom line is use the "main " as it is... it was amazing.
@CodingWithJohn
@CodingWithJohn Жыл бұрын
Yep, just use it as it is. But it's good to know why it is how it is!
@philbowden
@philbowden 10 ай бұрын
Thanks for this. Nicely done. One question I have is can you think of a realistic use case for assigning value to the String[] args array?
@sm7289
@sm7289 2 жыл бұрын
Java: class MainClass { public static void main (String [] args) { System.out.println("Hello World"); } } Python: print("hello world")
@adelacristea153
@adelacristea153 2 жыл бұрын
Yep.... that was my teacher, like:" no more questions" :-/ Thank you for this great video. :D
@stephanieezat-panah7750
@stephanieezat-panah7750 Жыл бұрын
hahaha! I had a really good chuckle, those first 30 seconds. "Don't ask! shut up, no don't! stop. Just do it, put it in there!" I was on the receiving end of that. Art imitates life, right?
@franciscogrosso6533
@franciscogrosso6533 Жыл бұрын
Amazing explanation, thank u so much!
@Imsulaf
@Imsulaf Жыл бұрын
The story in the beginning is so accurate
@fredericoamigo
@fredericoamigo 3 жыл бұрын
Definitely demystified a lot of things for me here! Super useful vid for me who is learning Java coming from python :-)
@pranavnyavanandi9710
@pranavnyavanandi9710 2 жыл бұрын
Mee too, coming to Java from Python. 😊 Initially, I would do a lot of comparison between the two.
@codyj07161989
@codyj07161989 2 жыл бұрын
"It's kind of like saying hey I'm a great program and the JRE goes 'great how can I run you'? and he's like you can't. Only I can run me." "and that's a pretty useless program". This statement while maybe not intended to be interpreted nor regarded in this way is full of wisdom not only in regards to coding but when applied to life in general, lol🤣. 10/10. Just wanted to point that out. Thank you for all the vids John, you're helping me a lot.
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
Philosophy with John
@samim7373
@samim7373 2 жыл бұрын
Thank you for sharing, I was hopping you can explain it better than others, can you try to explain it with example for a beginners that we can understand it easily.
@gopalkannan4934
@gopalkannan4934 2 жыл бұрын
Thank you. It is useful for interview
@davannaleah
@davannaleah Жыл бұрын
If you could, please add to this about having multiple arguments rather than just one.
@LBCreateSpace
@LBCreateSpace Ай бұрын
This was very helpful, thank you
@elvispontes4165
@elvispontes4165 2 жыл бұрын
your videos are awesome!! Thanks a lot for sharing
@anormalguy8407
@anormalguy8407 3 жыл бұрын
This is the kind of stuff I think about at 3 am in the morning. Now I can finally rest in peace
@CodingWithJohn
@CodingWithJohn 3 жыл бұрын
RIP A normal guy
@ROSUJACOB
@ROSUJACOB 2 жыл бұрын
Thank you John for the video.
@TezlaByte
@TezlaByte 2 жыл бұрын
Haven't seen the video yet... But that's exactly what I asked yeaaars ago trying to do C# I never progressed.
@alexzink4451
@alexzink4451 10 ай бұрын
Hello, Sir! We'd all really appreciate if you break down SOLID on this channel, especially LSP🙏🙏🙏
@snich1950
@snich1950 2 жыл бұрын
Man. I have to tell your channel to my classmates, coz I'm having trouble explaining Java to them.
@saraproetti5039
@saraproetti5039 Жыл бұрын
you are amazing teacher! Thank you
@yashchandak8016
@yashchandak8016 10 ай бұрын
Great explanation sir
@asagiai4965
@asagiai4965 2 жыл бұрын
Unlucky for them or those then. Our good prof (but can be mean sometimes) explains it. And I think the very first thing also.
@rohithv63
@rohithv63 2 жыл бұрын
Could you please make a video explaining each part of System.out.println()? Thank you
@colbyboucher6391
@colbyboucher6391 2 жыл бұрын
It's a method called println(), which is part of the *out* field in the System class. "Out" in this case is an instance of PrintStream.
@lavanyaan2158
@lavanyaan2158 4 ай бұрын
Thank you so much for the video 🙏🙏🙏
@CodeKurdi
@CodeKurdi 3 жыл бұрын
you are Legend man, lesson with fun and a lot info:)
@suwatchainanchai6637
@suwatchainanchai6637 2 жыл бұрын
Do u have a video that teach about java command and show what the behind scene of the command working ? .and may be about maven and gradle that would be great too.
@ob0-china
@ob0-china Жыл бұрын
Great video! Though I've got one question left. How do I pass multiple arguments (so that the args array contains more than one string)?
@sebon11
@sebon11 2 жыл бұрын
Lovely tutorial!
@andreas_tech
@andreas_tech 2 жыл бұрын
I think that this style of explanation - starting from the absolute bottom first, explaining all this st*pid keywords (of this alien language ;) - is the best appraoch you can have. Even if it takes some minutes longer, it will clear out some questions that every newbie has at the beginning. [even better would be some history on WHY this or that keyword had to be invented...] Thanks man.
@mahodaadikari4116
@mahodaadikari4116 2 жыл бұрын
Super cool and amazing explanation 👏🏻❤
@bryangonzales4145
@bryangonzales4145 3 жыл бұрын
0:00 Yup that "somebody" is my Teacher.
@abdennadhermayssa1890
@abdennadhermayssa1890 3 жыл бұрын
Super clear great job and thank you
@skylarngoi3262
@skylarngoi3262 3 жыл бұрын
Thanks for your explanation..
@vigneshwaranr680
@vigneshwaranr680 2 жыл бұрын
Love your teaching. I mean it ❤
@MrsWeasleyking15
@MrsWeasleyking15 2 жыл бұрын
this was so clear thank youu
@bryceblankinship
@bryceblankinship 2 жыл бұрын
5:30 chimichanga
@pradiptonath4323
@pradiptonath4323 2 жыл бұрын
Great explanation
@MrJayenta
@MrJayenta 2 жыл бұрын
Sir please upload some on spring boot course
@user-pr9pq8en2d
@user-pr9pq8en2d 2 жыл бұрын
I love you man, I really needed this video.
How to Run Java Programs With Command Prompt (cmd) and Notepad in Windows
5:43
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 563 М.
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 19 МЛН
Каха и дочка
00:28
К-Media
Рет қаралды 1,9 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 53 МЛН
[BEFORE vs AFTER] Incredibox Sprunki - Freaky Song
00:15
Horror Skunx 2
Рет қаралды 20 МЛН
Static vs Non-Static Variables and Methods In Java - Full Simple Tutorial
11:29
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 768 М.
Learn Java in One Video - 15-minute Crash Course
14:54
Coding with John
Рет қаралды 779 М.
Main Method In Java Tutorial #57
9:50
Alex Lee
Рет қаралды 121 М.
Lambda Expressions in Java - Full Simple Tutorial
13:05
Coding with John
Рет қаралды 778 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 840 М.
Generics In Java - Full Simple Tutorial
17:34
Coding with John
Рет қаралды 1,1 МЛН
Learn Regular Expressions In 20 Minutes
20:52
Web Dev Simplified
Рет қаралды 1,3 МЛН
Java is ALWAYS Pass By Value. Here's Why
5:22
Coding with John
Рет қаралды 127 М.
Git Tutorial For Dummies
19:25
Nick White
Рет қаралды 1,2 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 19 МЛН