Java Tutorial For Beginners 21 – 'static' keyword in Java

///Java Tutorial For Beginners 21 – 'static' keyword in Java

Java Tutorial For Beginners 21 – 'static' keyword in Java

FavoriteLoadingAdd to favorites

Searches related to java static meaning
static method in java
define static java
difference between static and nonstatic methods in java
use of static in java
when to use static methods in java
how to call static method in java
difference between static method and non static method in java
accessing non static from static method

source

Java468x60
By |2019-09-03T22:16:38+00:00September 3rd, 2019|Java Video Tutorials|45 Comments

45 Comments

  1. Lily Nelson September 3, 2019 at 10:16 pm - Reply

    the font makes hello look really weird

  2. tejaswi goyal September 3, 2019 at 10:16 pm - Reply

    poor explanation or can say worst explanation. If you don't know how to explain in English please switch your language to Hindi.

  3. Tim TimTim September 3, 2019 at 10:16 pm - Reply

    i have a little suggestion,in this part 5:07,i think it's better use different name for class and instance (or object)..i know "Hello" is class name,"hello" is instance"s name. but it may make people confuse.because both names are "hello" ,it's better use different word,i think. Thanks

  4. Akash Gurung September 3, 2019 at 10:16 pm - Reply

    thank you sir for the explanation ..it was very clear 🙂

  5. Mrigank Chugh September 3, 2019 at 10:16 pm - Reply

    crisp and clear!

  6. Java Tutorial September 3, 2019 at 10:16 pm - Reply

    All about static keyword in java in depth
    https://www.youtube.com/watch?v=GGay1K5-Kcs&t=119s

  7. Adrian Salabanzi September 3, 2019 at 10:16 pm - Reply

    It was clear until the 8th time I watched it. Thanks anyway!

  8. B Hole September 3, 2019 at 10:16 pm - Reply

    To anyone who might still be confused on this topic: get ready. This is a bit lengthy but should clear up any confusion. Drop a comment if still confused.
    A CLASS is like a BLUEPRINT for a type of BUILDING that is mass produced. Each building might have a different number of windows, serve a different role, or have a different number of residents inside, but they all are made with the same basic blueprint.
    An OBJECT is like any ONE of those specific buildings. It is an INSTANCE of the blueprint, that is, it is an actual BUILDING created from the basic framework/blueprint that ALL other buildings are based on.
    In Java, a CLASS may define NON-STATIC METHODS AND VARIABLES. NON-STATIC METHODS are methods that you can use on a specific instance, or OBJECT, of the class to do something with that OBJECT. Using a NON-STATIC METHOD will ONLY directly affect the OBJECT it is called upon, and no other OBJECTS beside it. NON-STATIC VARIABLES are variables that every INSTANCE/OBJECT of the class HAS, but whose VALUE/CONTENTS are individually unique and different for each OBJECT. As an example, if an architect has one blueprint (the CLASS in this example) for constructing buildings, a NON-STATIC VARIABLE of the building CLASS might be the number of windows (let's name it numberOfWindows): each individual building (OBJECT) has A particular value for numberOfWindows, but it varies from building to building and the number of windows depends on the building you're looking at. A NON-STATIC METHOD of the building class might be called OpenDoor: the OpenDoor NON-STATIC METHOD can only be called on a particular OBJECT, and calling it on a given OBJECT does not affect other OBJECTS. It only opens the door of THAT particular building.
    STATIC means RELATED TO THE BLUEPRINT ITSELF, THE CLASS, in other words, NOT TO ANY ONE PARTICULAR INSTANCE (OBJECT). There are two important types of static items in Java: STATIC VARIABLES, and STATIC METHODS. STATIC VARIABLES are variables that THE CLASS ITSELF has – it's a shared, "all-object" variable. If you refer to a STATIC CLASS VARIABLE on a PARTICULAR OBJECT, the value will be the same regardless of which OBJECT you choose. Technically, however, the proper way to access a STATIC CLASS VARIABLE is to type the CLASS name, followed by a period, followed by the STATIC VARIABLE. If the blueprint specifies that all buildings should have the same height, for example, then buildingHeight might be a STATIC variable since it's inherent and built into the blueprint, and can't be anything else regardless of the building. This doesn't mean you can't CHANGE the height in the blueprint – it just means that if you do, it's an aspect of the BLUEPRINT you're changing, and not an aspect of any one individual building that you're changing. Finally, there are STATIC METHODS. These are methods that do something without the need for any particular OBJECT of the CLASS. In our building blueprint example, a STATIC METHOD might be something like an equation on the blueprint that gives you an estimate of the cost of constructing a building based on the location of construction, specified by the user – without having to specify a specific BUILDING, or OBJECT. Hope this helps, all!

  9. Bob Allan September 3, 2019 at 10:16 pm - Reply

    Raise your hand if you just tore your smoke detector off the wall for no reason.

  10. David Song September 3, 2019 at 10:16 pm - Reply

    Nobody talked about smoke detector issue?

  11. Rhythm Tamang September 3, 2019 at 10:16 pm - Reply

    Uppercase "H" "Hello" and Lower case "h" "hello" at 3:34. That should help out clear things.

  12. himanshu jain September 3, 2019 at 10:16 pm - Reply

    You only were getting confused. After assigning a value to hello1.age as 50, you should print both hello1.age and hello.age. The output for the hello.age will also get changed to 50 as age is a static variable, depends only upon class not on the instance and it changed for every instance after assigning it any value in any instance.

  13. Bryson Allen September 3, 2019 at 10:16 pm - Reply

    So basically does static mean you can access that variable anywhere

  14. Smart Programming September 3, 2019 at 10:16 pm - Reply

    good explanation sir, thanks🙂🙂

  15. Willie Scant Company September 3, 2019 at 10:16 pm - Reply

    this static class is confusing

  16. Techno Boy September 3, 2019 at 10:16 pm - Reply

    Left your videos from here. Thank you for not explaining properly. Good job.

  17. VK Gamer September 3, 2019 at 10:16 pm - Reply

    how to export the codes to apk file for android?

  18. Max Ro September 3, 2019 at 10:16 pm - Reply

    Confusing and replace your smoke detector batteries!

  19. Gaurav Raskar September 3, 2019 at 10:16 pm - Reply

    As u said at the last that static variables should be accessed by its class, so if i want to access ages of multiple users how can i differentiate between them?…

  20. sponge bob September 3, 2019 at 10:16 pm - Reply

    Static = you can use the variable or method without defining that Class.

  21. bishopoftroy September 3, 2019 at 10:16 pm - Reply

    By this video i realized that this course will not teach me much. Thank you for your effort though.

  22. Mushtaque Inamdar September 3, 2019 at 10:16 pm - Reply

    I understand after watching 2 times, just confused because of Hello word, after focusing i realizes when you use static Method use directly CAPITAL LETTER "H" Hello which is Main Class Name and when you use Non static Method use defined instant name or object name in small letter 'h' hello , I hope it is correct.

  23. Hassaan Ilyas September 3, 2019 at 10:16 pm - Reply

    waah ustaad

  24. Warda Hamk September 3, 2019 at 10:16 pm - Reply

    explain this what does static keyword mean in java?
    https://www.quora.com/What-is-the-meaning-of-static/answer/Prajwal-Dcunha

  25. Warda Hamk September 3, 2019 at 10:16 pm - Reply

    great

  26. SolarFaze September 3, 2019 at 10:16 pm - Reply

    What does DoSomething mean?

  27. Felix Amaro September 3, 2019 at 10:16 pm - Reply

    I finally got it, thank you so much!

  28. ElXav September 3, 2019 at 10:16 pm - Reply

    Thanks

  29. Alex Fancy September 3, 2019 at 10:16 pm - Reply

    I could understand your other videos but I am so confuse with this one and i still don't understand the difference between static and non static.

  30. Arturo Fernandez September 3, 2019 at 10:16 pm - Reply

    such bad explanation… I quit the video at 3:40 since you have not explain anything until then and you go around the topic…

  31. sai tawale September 3, 2019 at 10:16 pm - Reply

    Hello hello hello everywhere. I didn't understand this video at all. Just that static belongs to a class and not an instance 🙁

  32. Arnab Majumder September 3, 2019 at 10:16 pm - Reply

    I think we use static for memory management. If i call a static method by instance of a class it takes new memory for creating that instance. But u can call that static method with class name, so why i'm going to take some memory for access static method. That's it.

  33. Vikram Reddy September 3, 2019 at 10:16 pm - Reply

    i got understood this tutorial to some far extent.You delivered this WELL.But ,i have no clarity that "why we are using/placing this static keyword in header of main method" (or) "why we should use this static keyword in main method header?!".IS IT THAT NECESSARY? IF SO, reply me and mention its importance!!!!!!!!!!

  34. ehsan ullah Khan September 3, 2019 at 10:16 pm - Reply

    Great explination

  35. Pradeep Kumar September 3, 2019 at 10:16 pm - Reply

    this guy making fool of us …. he made two different instance of a static class level data …and in the end said the print is same but it printed different…. I think we should leave these stupid tutorial here …. what I understood is the static method or data type…should b accessed through class itself to make it more efficient, to save memory .rather than instance .

  36. Carlos C September 3, 2019 at 10:16 pm - Reply

    For those who know Ruby. The static refers to class instance and without static refers to method instance

  37. Game Foot September 3, 2019 at 10:16 pm - Reply

    7:197:39 is everything you need to know, the video is kind of messy(Helloohhlleoeoolllo)… and how can you record with the friggin beeping through so many episodes???

  38. Vikram J Singh Bajwa September 3, 2019 at 10:16 pm - Reply

    Thanks buddy , Good work keep it up……………………….

  39. Xiaoyi Zhang September 3, 2019 at 10:16 pm - Reply

    I think it would be better if the last print line can be changed from
    System.out.println(hello1.age);           into
    System.out.println(hello.age);

    So that people know that change of static member in one instance works for all other instances of the same class.

  40. chandrahas kondle September 3, 2019 at 10:16 pm - Reply

    1)in this video you didnot tell us what's the use of static keyword
    2)how and when is memory allocation done for static variables or methods
    3)program relating that shit(1,2)

  41. getrichordietryin September 3, 2019 at 10:16 pm - Reply

    Have to watch it in 2x speed

  42. Theonewhorecksyo twice September 3, 2019 at 10:16 pm - Reply

    Thank you for making this video.

  43. Abdur Rahman Robin September 3, 2019 at 10:16 pm - Reply

    good vid for understanding static 🙂

  44. rakesh verma September 3, 2019 at 10:16 pm - Reply

    can you tell me … how can we print a string by DoSomething() function… I mean you didn't print " hi youtube " … you only print the value of integer … Can you tell me ? How can we " hi youtube " in a similar way

  45. AK 47 September 3, 2019 at 10:16 pm - Reply

    To summarize this whole video:
    a static method is one that can be invoked through its class name.

    BTW, He explained it well. The only problem is that he used "Hello" for the class's name and "hello" for the variables' names which is the main reason why many of you here didn't understand.

Leave A Comment

*