Sitemap

Member-only story

Understanding Static Methods in Java

7 min readOct 8, 2026

--

The static keyword is one of the most important—and sometimes confusing—concepts in Java.

The easiest way to understand static is to connect it with something you already know:

A static variable belongs to the class, whereas a non-static variable belongs to an object.

The same idea applies to methods.

When a method is declared static, it is associated with the class rather than with individual objects.

1. Static Method vs. Non-Static Method

Suppose we have a class called A:

class A {
public void method1() {
System.out.println("Method 1");
}
public static void method2() {
System.out.println("Method 2");
}
}

Now create two objects:

A object1 = new A();
A object2 = new A();

Because method1() is non-static, it belongs to objects.

Conceptually, both objects have access to their own instance behavior:

object1 → method1()
object2 → method1()

But method2() is static.

It belongs to the class:

A → method2()

There is no need to create an object to call it:

A.method2();

You don’t need:

object1.method2();

--

--

Priyanka
Priyanka

Written by Priyanka

Software developer sharing practical insights on development & modern technology. Writing about concepts, lessons learned & real-world development experiences.