File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
static method vs instance method
Joined: May 20, 2007
Jan 02, 2009 00:20:00
What is difference between static method and instance method.
which one one is better in terms of memory and performance.
Joined: Oct 13, 2005
Jan 02, 2009 01:08:00
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.
Joined: Aug 08, 2007
Jan 02, 2009 06:32:00
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
I agree. Here's the link:
subject: static method vs instance method
Sttatic vs non static methods
same signature static + instance method
Reg. local variables
static method loading
why static methods cannot override or overload?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014