If you have a Car class and an OpenDoor() method then you have to have an instance of the Car class in order to be able to call OpenDoor() on it. On the other hand, if there is a method called MilesPerGallonToLitresPer100Km() you don't have to have a Car object for it to make sense - it can be static, operating within the class, but not on any concrete object belonging to that class. Answer from bsakiag on reddit.com
🌐
GeeksforGeeks
geeksforgeeks.org › java › static-keyword-java
static Keyword in Java - GeeksforGeeks
The static keyword in Java is used for memory management and belongs to the class rather than any specific instance.
Published   1 month ago
🌐
Reddit
reddit.com › r/learnprogramming › what does the "static" keyword mean in java and why is the main method required to have it?
r/learnprogramming on Reddit: What does the "static" keyword mean in java and why is the main method required to have it?
June 19, 2022 -

I am new to object oriented programming, and I was following a tutorial in which they mentioned that in java, the keyword static means that the particular member belongs to a type itself, rather than to an instance of that type. I have read this definition a lot of times across the internet but this is complex for me to understand, can anyone tell me in simple language what it means? Thanks!

Discussions

java - What does the 'static' keyword do in a class? - Stack Overflow
Sounds like a recursive nightmare to me but i'm a Java newbie. 2017-11-05T16:07:48.77Z+00:00 ... If the static member of a class is referenced by 2 different threads then how many instances are there of that static member? I feel like it's 2 but if you want the same instance across threads then the volatile keyword ... More on stackoverflow.com
🌐 stackoverflow.com
In laymans terms, what does 'static' mean in Java? - Stack Overflow
There are also a few less common uses of the keyword static. There are static imports which allow you to use static types (including interfaces, annotations, and enums not redundantly marked static) unqualified. //SomeStaticThing.java public class SomeStaticThing { public static int ... More on stackoverflow.com
🌐 stackoverflow.com
programming languages - False friends? Keyword "static" in C compared to C++, C# and Java - Software Engineering Stack Exchange
To me, the use of the keyword static in C and languages like C# and Java are "false friends" like "to become" in English and "bekommen" in German (= "to get" in English), because they mean different More on softwareengineering.stackexchange.com
🌐 softwareengineering.stackexchange.com
March 28, 2012
What is the advantage of "companion object" vs static keyword - Language Design - Kotlin Discussions
Again, newby to Kotlin here. Generally, the changes from Java are great improvements. That said… Why was the companion object concept created instead of using the static keyword for class methods and fields? I find it cumbersome, and it clashes with my style of writing code which is to put ... More on discuss.kotlinlang.org
🌐 discuss.kotlinlang.org
3
August 4, 2017
🌐
W3Schools
w3schools.com › java › ref_keyword_static.asp
Java static Keyword
The static keyword is a non-access modifier used for methods and attributes. Static methods/attributes can be accessed without creating an object of a class. Read more about modifiers in our Java Modifiers Tutorial.
🌐
DataCamp
datacamp.com › doc › java › static
static Keyword in Java: Usage & Examples
Java keywordsIntroduction To JavaJava File HandlingJava Language BasicsJava ArraysJava Object-Oriented Programming ... The static keyword in Java is used for memory management primarily. It can be applied to variables, methods, blocks, and nested classes. When a member is declared static, it ...
🌐
Codidact
software.codidact.com › posts › 284243 › 284256
What are the disadvantages of using static methods in Java? - Software Development
... I was using static method few moments ago. But I noticed that I was returning a variable using that static method. According to the article, Static is a keyword that identifies the class-related thing.
🌐
Baeldung
baeldung.com › home › java › core java › a guide to the static keyword in java
A Guide to the Static Keyword in Java | Baeldung
January 8, 2024 - In this tutorial, we’ll explore the static keyword of the Java language in detail. The static keyword means that a member – like a field or method – belongs to the class itself, rather than to any specific instance of that class.
Top answer
1 of 16
656

static members belong to the class instead of a specific instance.

It means that only one instance of a static field exists[1] even if you create a million instances of the class or you don't create any. It will be shared by all instances.

Since static methods also do not belong to a specific instance, they can't refer to instance members. In the example given, main does not know which instance of the Hello class (and therefore which instance of the Clock class) it should refer to. static members can only refer to static members. Instance members can, of course access static members.

Side note: Of course, static members can access instance members through an object reference.

Example:

public class Example {
    private static boolean staticField;
    private boolean instanceField;
    public static void main(String[] args) {
        // a static method can access static fields
        staticField = true;

        // a static method can access instance fields through an object reference
        Example instance = new Example();
        instance.instanceField = true;
    }

[1]: Depending on the runtime characteristics, it can be one per ClassLoader or AppDomain or thread, but that is beside the point.

2 of 16
133

It means that there is only one instance of "clock" in Hello, not one per each separate instance of the "Hello" class, or more-so, it means that there will be one commonly shared "clock" reference among all instances of the "Hello" class.

So if you were to do a "new Hello" anywhere in your code: A- in the first scenario (before the change, without using "static"), it would make a new clock every time a "new Hello" is called, but B- in the second scenario (after the change, using "static"), every "new Hello" instance would still share and use the initial and same "clock" reference first created.

Unless you needed "clock" somewhere outside of main, this would work just as well:

package hello;
public class Hello
{
    public static void main(String args[])
    {
      Clock clock=new Clock();
      clock.sayTime();    
    }
}
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › why-static-in-java-what-does-this-keyword-mean
Why Static in Java? What does this keyword mean? [Solved]
June 24, 2022 - You can use the static keyword in different parts of a Java program like variables, methods, and static blocks. The main purpose of using the static keyword in Java is to save memory. When we create a variable in a class that will be accessed ...
🌐
Simplilearn
simplilearn.com › home › resources › software development › static in java: an overview of static keyword with examples
Static in Java: An Overview of Static Keyword in Java With Examples [2024 Edition]
June 9, 2025 - Explore the power of the static keyword in Java! Learn how to use static variables, methods, and blocks with clear examples in our comprehensive overview.
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Quora
quora.com › What-does-static-keyword-do-in-Java
What does 'static' keyword do in Java? - Quora
Answer (1 of 42): Java Static Keyword Static is a Non Access Modifier. Applicable to The Static keyword can be applied to * Method * Variable * Class nested within another Class * Initialization Block Not Applicable to The Static keyword can not be applied to * Class (Not Nested) * Co...
🌐
Coders Campus
coderscampus.com › home › static keyword in java
Static Keyword in Java - Coders Campus
May 3, 2021 - Okay, so now that I've drilled that into your brains, I can talk about what the static keyword in Java means. In Java, you can make variables and methods static. Static methods and variables can also be called static methods and static variables. Why are they also called this?
🌐
Geekster
geekster.in › home › static keyword in java
Static Keyword in Java (with Example)
June 27, 2024 - The static keyword in Java is mainly used for memory management. The static keyword in Java is used to share the same variable or method of a given class. The users can apply static keywords with variables, methods, blocks, and nested classes.
🌐
Sololearn
sololearn.com › en › Discuss › 3283319 › anyone-explain-me-static-keyword-in-java-all-functions-and-uses-this-make-me-confused-a-lot
Anyone explain me static keyword in java . All functions and uses. This make me confused a lot. | Sololearn: Learn to code for FREE!
Here is the SoloLearn lesson about static methods. https://www.sololearn.com/learn/o-Java/2159/?ref=app ... The 'static' keyword is used to declare a variable or method to be part of the class itself rather than an instance of it.
🌐
GeeksforGeeks
geeksforgeeks.org › java › static-method-in-java-with-examples
Static Method in Java With Examples - GeeksforGeeks
In Java, the static keyword is used to create methods that belongs to the class rather than any specific instance of the class.
Published   May 2, 2025
🌐
Programiz
programiz.com › java-programming › static-keyword
Java Static Keyword (With Examples)
If we want to access class members without creating an instance of the class, we need to declare the class members static. The Math class in Java has almost all of its members static. So, we can access its members without creating instances of the Math class.
🌐
Kotlin Discussions
discuss.kotlinlang.org › language design
What is the advantage of "companion object" vs static keyword - Language Design - Kotlin Discussions
August 4, 2017 - Again, newby to Kotlin here. Generally, the changes from Java are great improvements. That said… Why was the companion object concept created instead of using the static keyword for class methods and fields? I find it cumbersome, and it clashes with my style of writing code which is to put ...
🌐
Edureka
edureka.co › blog › static-keyword-in-java
Static Keyword in Java | Static Block, Variable, Method & Class | Edureka
November 29, 2022 - In Java, static keyword is mainly used for memory management. It can be used with variables, methods, blocks and nested classes. It is a keyword which is used to share the same variable or method of a given class.
🌐
Quora
quora.com › What-is-the-purpose-of-the-static-keyword-in-Java-Can-we-make-any-class-static-even-if-it-doesnt-have-a-main-function
What is the purpose of the static keyword in Java? Can we make any class static, even if it doesn't have a main() function? - Quora
Answer: static is to make it so a class member is unrelated to any instance of that class. Rather, a static member is related to the class itself and not its instances. Well, “related to the class” may be overstating it.