Difference between static and non-static method in Java

Last Updated : 20 Aug, 2026

In Java, methods can be classified as static and non-static (instance) methods. A static method belongs to the class and can be called without creating an object, whereas a non-static method belongs to an object and is generally called using an object of the class.

  • Static methods are declared using the static keyword and are associated with the class.
  • Non-static methods are associated with objects (instances) of the class.

Static Method

A static method is a method declared using the static keyword. It belongs to the class rather than to individual objects.

  • Does not require an object for a direct class-level call.
  • Can directly access only static members.
  • Cannot directly access instance variables or instance methods.
Java
class Calculator {

    // Static method
    public static int sum(int a, int b) {
        return a + b;
    }
}

public class Main {
    public static void main(String[] args) {

        // Calling static method using class name
        int result = Calculator.sum(3, 6);

        System.out.println("Sum: " + result);
    }
}

Output
Sum: 9

Explanation: The sum() method is static, so it belongs to the Calculator class. It can be called using Calculator.sum() without creating a Calculator object.

Non-Static Method

A non-static method, also called an instance method, is a method that belongs to an object of a class.

  • Usually called using an object.
  • Can also access static variables and static methods.
  • Can be overridden in a subclass.
Java
class Calculator {

    // Non-static method
    public int sum(int a, int b) {
        return a + b;
    }
}

public class Main {
    public static void main(String[] args) {

        // Creating object
        Calculator calculator = new Calculator();

        // Calling non-static method using object
        int result = calculator.sum(3, 6);

        System.out.println("Sum: " + result);
    }
}

Output
Sum: 9

Explanation: The sum() method is a non-static method, so it is associated with a Calculator object. Therefore, it is called using the calculator object.

Static Vs Non-Static Method

FeatureStatic MethodNon-Static Method
DefinitionA method associated with the classA method associated with an object
KeywordDeclared using staticDeclared without static
CallingCan be called using the class nameGenerally called using an object
Object RequiredNo object is required for a direct class-level callAn object is generally required
Instance MembersCannot directly access instance variables or methodsCan directly access instance variables and methods
Static MembersCan directly access static variables and methodsCan directly access static variables and methods
this ReferenceCannot use thisCan use this
Binding/DispatchDoes not use runtime overriding dispatchOverridden methods use runtime method dispatch
OverridingCannot be overridden; can be hiddenCan be overridden
PolymorphismDoes not support runtime method overridingSupports runtime polymorphism
MemoryMethod code is not copied for each objectMethod code is not copied for each object
Typical UseUtility or class-level operationsOperations that depend on object state
Comment