Types of methods:-
1) Instance methods:
They
can be accessed through object.
eg:
objname.methodname(args);
2) static methods:-
They
can be accessed through class. They access only the static variables directly.
They can also access non-static varaibles(instance variables) through object.
They never allow current object.
eg:
classname.methodname(args);
instance
|
static
|
runtime
memory allocation
|
compile
time
|
individual
memory allocation
|
common
|
can't
share
|
share
the data
|
access
through object name
|
classname
|
No comments:
Post a Comment