| Author |
static method vs instance method
|
rahman habib
Greenhorn
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
Sheriff
Joined: Oct 13, 2005
Posts: 32599
|
|
|
Static methods have nothing to do with performance or memory management. They affect different things. A static member:Is typed by the compilerIs not polymorphicCannot be overridden, only hiddenBelongs to the class, not the objectThere is only one copy of it per classEvery object of that class has access to the same static memberStatic 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
http://www.camilolopes.com/ About Java - Update every Week.
Guide SCJP - tips that you need know http://blog.camilolopes.com.br/livrosrevistaspalestras/
|
 |
 |
|
|
subject: static method vs instance method
|
|
|