Difference between static and non static methods in Java

June 8, 2023 · Team EasyExamNotes · 1 min read (est.) · 0 comments

Share on WhatsApp
FeatureStatic MethodNon-Static Method
AccessAccessed using the class name directly or through an object referenceAccessed only through an object reference
MemoryNo memory is allocated for “this” keywordMemory is allocated for “this” keyword
InvocationInvoked using the class name directly or through an object referenceInvoked using an object reference
OverridingCannot be overriddenCan be overridden
UtilityUsed for utility methods that are not specific to individual objectsUsed for behavior specific to individual objects
Access to Static MembersCan access static members directlyCan access static members directly or through the class name
Access to Non-Static MembersCannot access non-static members directlyCan access non-static members directly or through “this” keyword

Discussion

Ask a question, share your thoughts or report an error.

Sign in to participate in the discussion.

Join the discussion