Тёмный

Java Tutorial for Beginners - 19 - Static Variables and Static Methods 

EJ Media
Подписаться 170 тыс.
Просмотров 71 тыс.
50% 1

Опубликовано:

 

30 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 94   
@daffertube
@daffertube 8 лет назад
I love this "explain to me like I'm 5" style. You are simply the best at making programming concepts easily understandable to the laymen!
@JakeCastle60163
@JakeCastle60163 5 лет назад
yeah at this point I am still a five year old building my vocabulary and learning how to pronounce syllables.
@albertwesker2050
@albertwesker2050 5 лет назад
I didn't see the first quotation mark and I was really confused.
@debabrataroy3643
@debabrataroy3643 5 лет назад
It is very difficult to learn something like this on your own, as opposed to in an academic environment. You don't have the opportunity to discuss or ask questions to peers. You filled the void for me, Thank you! You have done a wonderful job, please keep doing it.
@astrowiz3544
@astrowiz3544 5 лет назад
Hehe, void
@SMOKE3104
@SMOKE3104 7 лет назад
It's hard to find a RU-vidr that will break everything down "Barney Style", It gives the user so much insight because helps them follow along with things they can refer to. Most beginner tutorials are quick to throw out program Jargin. Great job A += A.
@clutchmadness
@clutchmadness 6 лет назад
When I realised how good this tutorial was, I actually came back to this video just so that I could give it a like :)
@shadowfront21
@shadowfront21 3 года назад
Its been said many times in the comments already, but your tutorials truly are the best I've found for beginners such as myself. Too often, tutorials and instructors simply regurgitate the technical jargon that has become second nature to them over the years. Their familiarity with the language makes it as simple as 2+2, and they fail to remember that was not always the case. Greatly appreciate the way you "dumb it down" for us and explain how everything works in terms that novices such as myself can easily ingest.
@firstcomesrock8593
@firstcomesrock8593 4 года назад
I don't know why I've struggled with this concept, but I love how you explained this concept.
@punjabi1995
@punjabi1995 Год назад
I have taken a python course in college and purchased Udemy courses to practice Java automation. Even courses that say they are for beginners skim past details as if it's supposed to be common knowledge, yet you paused and seamlessly answered every question that popped up in my head along the way. Thank you for being thorough, your time really paid off.
@loganphillips1674
@loganphillips1674 8 лет назад
Thanks for this explanation. I find it frustrating when people don't explain why something is the way it is. You explain everything, thank you. I would be interested in you going more in depth about the JVM. There's a lot on it and I think you would explain it very well. Anyway, thanks for the video!
@COD10ism
@COD10ism 9 лет назад
Great video! i am brand new to java, i had a basic class 4 almost 5 years ago my freshmen year of high school and i could not retain any of the information presented to me. it was really hard for me to learn! After i began watching your videos you make it so much clearer and easier to understand. i can not wait to get to your other playlists! thank you so much!
@EJMedia1
@EJMedia1 9 лет назад
+Greg McDowell Thanks!
@enescusteven6832
@enescusteven6832 7 лет назад
hey greggg
@dorsloim2866
@dorsloim2866 8 лет назад
I have a test in Java tomorrow and i did not understand anything about static variables and methods. So i googled it and thank god your video poped up you you are a real savior man! Thanks a lot mate you're a really good teacher!
@재강-q1f
@재강-q1f 6 лет назад
Wow literally the best video to explain static. I watched like dozens of videos to understand this concept but they all just explained about technical stuff not why. Thank you so much!
@asdakuhi8h
@asdakuhi8h 4 года назад
... 3 years after I took my java class in college I finally understand static. THANK YOU!!!
@gniw1584
@gniw1584 5 лет назад
Best explanation about the memory and static! Thanks!! I was puzzled in the last few days, your 15 min saves my few days of brain cells.
@nonobeijing
@nonobeijing 9 лет назад
Excellent! Crystal clear... I was very confused, that's no longer the case thanks to you EJ Media
@roomina2010
@roomina2010 8 лет назад
You have Java tutorial , wow cool , I was looking exactly for your java tutorial and I wished you have Java tutorial , because I followed all your tutorial in CSS, JavaScript , Asp.net. I am so happy to find you in java , you are so cool guy . thank you man , you are the best tutor I've ever seen since I started my program Computer Science at collage, If I wanted to say one things great about your tutorials is these are stars from very basic and continue to get complicate and totally those are complete and another thing is your voice is soft , smooth, fluent and understandable especially for English second languages.Thank you so much
@EJMedia1
@EJMedia1 8 лет назад
+Saam Safi Why thank you :)
@matthewc3666
@matthewc3666 8 лет назад
Thank you, one of the easiest explanations I have found so far.
@rekaviles
@rekaviles 6 лет назад
This explanation is exactly what I've been looking for. Thank you for these tutorials!
@yaboyshelz
@yaboyshelz 6 лет назад
I appreciate that you admitted that it was a bit of a struggle to understand this.... Its not as easy as people make it seem at first
@abdullaha2585
@abdullaha2585 9 лет назад
Honestly, you made it simple brother
@senri-
@senri- 9 лет назад
Really enjoyed this video the examples were really good and made it easy to understand great job!
@jocelynzhang5712
@jocelynzhang5712 4 года назад
thanks for your so clear explanation in such an humorous way.
@ManyStandAlone
@ManyStandAlone 7 лет назад
I love these vids! Best vids I found so far and I have been teaching myself with the book and google for the past month. Man I wish i found your videos sooner!
@youareiamurim
@youareiamurim 5 лет назад
Wow! This is not like "explain a 5 year old"...its the intelligent way of explaining it...im a student in a university...they only said that static ment it didnt have to be called by an objekt!! True but misleading...doesnt give a logical resason as to why!! This was top notch!! I hope he keeps these videos gping! Thanks alot 😊👍
@HugoRamirezSoto
@HugoRamirezSoto 6 лет назад
Nice explained. Now this information has been loaded in my brain.
@danieloke9391
@danieloke9391 9 лет назад
Pretty good explanation :) Probably the best i have watched so far. Great Job! The rock against raging sea analogy was funny though ..lol
@ricardoedge
@ricardoedge 5 лет назад
This is a clear && excelent explanation, really nice work putting these concepts together!
@padurani
@padurani 7 лет назад
very well explained..... Thank u very much for your effort and time!!
@markokatic0001
@markokatic0001 10 лет назад
"They don't got away...It's like a rock" haha i like that sentences lol :D
@EJMedia1
@EJMedia1 10 лет назад
i try to add some humor lol !
@饶泽海
@饶泽海 8 лет назад
Super clearly explained, thanks!
@quranicverses2196
@quranicverses2196 7 лет назад
i really like your explaination, i have watch several videos but they aren''t a match to your's.keep it up and thanks a lot
@JakeCastle60163
@JakeCastle60163 5 лет назад
having learned MS BASIC in 1995; my head is still wrapped with my old crutches... taking this slow and I don't care how many times I have to got through this.
@elenagarciadiaz7440
@elenagarciadiaz7440 5 лет назад
A very useful and well explained tutorial
@lisfos7428
@lisfos7428 6 лет назад
thank you. you make this this topic easy to understand
@milesisterrible
@milesisterrible 6 лет назад
"it's like a cliff on the edge of the sea-it never goes away" hahahaha
@FilipCodes
@FilipCodes 5 лет назад
Great video and explanation. Thanks sir!
@itsdannyftw
@itsdannyftw 9 лет назад
Hi, so you mentioned that the garbage collector will remove the stuff after it's done... but when does this actually occur? How does it know WHEN to remove the object i.e. newuser1 and its associated variables, etc? Or is this insignificant in grasping the concept of how static works? Also, 2nd question, 4:30, if we did instantiate an object for the Registration class, why couldn't we access the static variable from that object? Isn't it 'always available (as it loiters around in run-time, as you say)? Or is it because of the point you make at the end of the video such that you wouldn't be able to do so? Could you elaborate? Thanks!
@gotofinancial
@gotofinancial 6 лет назад
you are the best man. i love your explanation. subscibed
@Arthur-hu3ce
@Arthur-hu3ce 7 лет назад
Great Vid! Simple explaination. Keep going.
@JustNotInBoba
@JustNotInBoba 8 лет назад
very useful video, Thank you so much
@oldiehugger
@oldiehugger 6 лет назад
Great video, just wonder if you can paste the codes as well so that we can practise right away.
@BczoffyouCh
@BczoffyouCh 7 лет назад
Thank you very very much for good tutorial
@CarlosFernandez-js8yn
@CarlosFernandez-js8yn 5 лет назад
Hey great video! I just want to get clear on something...in your constructor where you take a String parameter how come you didnt use this.usernameA= A??? I thought you always do that for your instance variable?
@deepin2urheart
@deepin2urheart 2 года назад
sir may we consider the instance variables as temporary placeholders of a value for its corresponding data type and once its utilisation is accomplished, its value gets flushed out or reset to original as it was created pls correct me if i am wrong 👍👍👍
@pallagijozsef9141
@pallagijozsef9141 7 лет назад
Congratulation this is a very very good explanation about static variable and method, thank you very much!!!! :) just one more thing, the static variable remains inside the RAM because when static comes out of stack it does not lose its variables ? or static variables and method does not even go into stack ?
@SH.K_
@SH.K_ 8 лет назад
it is such a great tutorial video !! thanks a lot!
@notsohopelessromantic
@notsohopelessromantic 7 лет назад
Thank you! This was super helpful
@HyperActive94
@HyperActive94 5 лет назад
Best explanation ever thanks!!
@davidfomin73
@davidfomin73 5 лет назад
Thanks man, great explanation
@annalisetrite7281
@annalisetrite7281 5 лет назад
Really good explanation
@mmkhan2143
@mmkhan2143 5 лет назад
your methode return type is int and you want to return a String value of usernameA what kind of programming is that?
@nicholas_himself
@nicholas_himself 8 лет назад
How come the constructor can access the static variables, even though it doesn't specify static?
@ivanpantic6701
@ivanpantic6701 6 лет назад
I am not sure if it is because something has changed but it gives me an error when I do this: public static void main(String[] args) { Registration.username;
@funnyrabbitadventures
@funnyrabbitadventures 7 лет назад
guys only one question if this : public int total2(int n) { return n = Speed + ModelDate; } is the same with this : public int total2() { return Speed + ModelDate; } Why should i use the first one and not just straight the second one? Second Question at program method if i use the first option it requires and int value which is doing nothing and it only prints the total sum anyway System.out.print(BmwM30.total2(10));
@7906jun
@7906jun 6 лет назад
had to watch this 6 times and still there are some gray areas but I feel somewhat comfortable moving on finally. But one question I have is that, why not make all the variables and methodes static? So I don't have to worry about static goes with static and instance goes with instance? Thanks.
@robertreimann1846
@robertreimann1846 8 лет назад
Holy shit! This is the fastest I have seen you typing so far :D
@EJMedia1
@EJMedia1 8 лет назад
I used to record in the light - now I record in the dark lol
@mariovictoria8707
@mariovictoria8707 7 лет назад
very simple and great tutorial :)
@onehungrygeek
@onehungrygeek 5 лет назад
Subbed! Amazing
@prakashpurohit5690
@prakashpurohit5690 6 лет назад
Sir, What is the mean of Return Value ?
@satoshinakamoto171
@satoshinakamoto171 6 лет назад
what if i want to find the list of names in my database ? how do i do that ?
@ianfischer103
@ianfischer103 5 лет назад
Java is the only language I know that has different types of variables like static and instance. I'm a noob so maybe that's the reason I don't know another language that does this. it's a very difficult concept to grasp. static variable to me sounds like an oxymoron. In plain old English, static means it doesn't change and variable means that it changes. This topic is a bit more clear now that I've watched this tutorial. Although it's still hazy on why the hell they would name these things this way?! I wish there was a better name, like persistent variables and persistent methods. "Static variable" is a horrible name. Thank you to EJ Media.
@nagagsalka5371
@nagagsalka5371 8 лет назад
very useful
@napowik2018
@napowik2018 6 лет назад
OMFG I've been enlightened :O
@hieubui7670
@hieubui7670 8 лет назад
Thank you!
@ainsleyharriott7649
@ainsleyharriott7649 7 лет назад
so a static method means that it is always there?
@vughdeziestem4358
@vughdeziestem4358 5 лет назад
Subs first, watching later...!!
@hafsasaud7715
@hafsasaud7715 9 лет назад
I have a question. You know how you said that static methods should go after static variables. So what about the main method, its static, but in all the previous videos there was no static variables that had been set but the main method was always static. Hope i make sense.
@EJMedia1
@EJMedia1 9 лет назад
Hafsa saud The main method is a little special - the best way to think of it is that its just the entry point for your program - that is its where everything gets kicked off - a starting point
@makkalam807
@makkalam807 7 лет назад
Not satisfied... can u give some valid reason
@jooosh7817
@jooosh7817 6 лет назад
I don't kind that "the best way to think" we want a deep explanation bout that static main method
@Jayce_2624
@Jayce_2624 4 года назад
Do static variables survive the heat death of the universe? I can't see a reason why not...
@napowik2018
@napowik2018 6 лет назад
7:10 outch, This is only a reference variable in the Stack memory and not an Object, object gets loaded to the heap with "new" syntax :O
@jiaqint961
@jiaqint961 5 лет назад
Thank you.
@vortyx090
@vortyx090 8 лет назад
ty
@photizoadom7786
@photizoadom7786 6 лет назад
Thank you
@ryanwittert4512
@ryanwittert4512 9 лет назад
THANK YOU!!
@raechellebrutus4308
@raechellebrutus4308 7 лет назад
Anyone watching these Tutorials live near Boise? If so we should link up I could use help understanding how some of this works if you got it down.
@barbarossa11
@barbarossa11 7 лет назад
And they all happily lived ever after...
@aprily5016
@aprily5016 7 лет назад
A static variable or a static method can be called by an object. But in the video 4:41 it denies the fact.
@meesie1
@meesie1 10 лет назад
So the method belongs to the class itself and can call the method without first creating a class instance.
@EJMedia1
@EJMedia1 10 лет назад
Correct static methods do not belong to an instance of the class or an object. Static variables and static methods belong to the class. They are not instantiated. Now the static method and variables are put into shared memory. So the other instanced version of the classes or objects can all see that shared memory so that is why they are accessible to anything static. And static always gets loaded first by the JVM ... it will scan for anything with a static keyword. In general though you should use object variables frist but there may be occasions you will use static variables but for the most part you want to use object variables.
@EJMedia1
@EJMedia1 10 лет назад
So unless you have a real good reason always try to use object variables and methods first. I just wanted to explain what static was in this video.
@MrAirPork1
@MrAirPork1 9 лет назад
I have 3 questions. 1) So is it safe to conclude that by making a static variable, its memory address never change thus it contains the same value and only changes when altered. While objects are created and destroyed after being compiled which leads to my second question that it can't be returned in a static method as it has already been destroyed. And lastly are static methods soley made for static variables only?
@EJMedia1
@EJMedia1 9 лет назад
MrAirPork1 Exactly static variables will last and instance variables are created and destroyed along with the object. I will say that most developers use instanced variables - there are really only a few reasons why you would use static and that's why I only spent 2 videos talking about static - for the most part you want to use instanced variables
@MrAirPork1
@MrAirPork1 9 лет назад
EJ Media Thanks a lot for answering my questions. Will continue to go through your tutorials
@Lallushe
@Lallushe 4 года назад
Thank you!
Далее
Don't bother ganking Ammar - ESL Dota 2
00:23
Просмотров 131 тыс.
#37 Static Variable in Java
7:06
Просмотров 165 тыс.
Java Tutorial for Beginners - 31 - Getters and Setters
12:01
Java multithreading 🧶
15:18
Просмотров 131 тыс.
Functions vs Classes: When to Use Which and Why?
10:49
Просмотров 162 тыс.
Static Method In Java Tutorial #76
5:54
Просмотров 34 тыс.
Java constructors 👷
10:37
Просмотров 189 тыс.