aspose file tools
The moose likes Beginning Java and the fly likes static method vs instance method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static method vs instance method" Watch "static method vs instance method" New topic

static method vs instance method

rahman habib

Joined: May 20, 2007
Posts: 8
What is difference between static method and instance method.
which one one is better in terms of memory and performance.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 40476
Static methods have nothing to do with performance or memory management. They affect different things. A static member:
  • Is typed by the compiler
  • Is not polymorphic
  • Cannot be overridden, only hidden
  • Belongs to the class, not the object
  • There is only one copy of it per class
  • Every object of that class has access to the same static member
  • Static methods cannot access instance methods or instance fields.
  • camilo lopes
    Ranch Hand

    Joined: Aug 08, 2007
    Posts: 202
    all depend on of the your objective, but static method, this pertence the class and instance method pertence the an object, this do not have relation with a class.
    in terms of perfomance nothing change.

    Brazil - Sun Certified Java Programmer - SCJP 5 About Java - Update every Week.
    Guide SCJP - tips that you need know
    wood burning stoves
    subject: static method vs instance method