Hi all,
Static Methods :
static methods can access only static variables.It cannot access instance variables.
static methods can call another static methods without the objects.
static methods can call instance methods using the object of the class.

Instance Methods:
Instance methods can access static variables also instance variables.
Instacne methods can call another instance methods without the objects.

Can any one tell me is any other points are added for the static methods and instance methods in java.

Is the above statements are wrong please specify which statements are wrong.

Thank you,


With Regards,
Prem

Static methods can access staic members of the same class, or instance members via an instance of the class.
Instance methods can access static members of the class, instance members of the same instance, or instance members of another instance via that instance.
Where "member" is a variable or a method.

Thank you for your response,
can u explain the second point clearly.

Instance methods can access static members of the class, instance members of the same instance, or instance members of another instance via that instance.

Thank you,

With Regards,
prem

Instance methods can access static members of the class
Instance methods can access instance members of the same instance
Instance methods can access instance members of another instance via that instance.

I don't know how to make that any clesrer

Can u give me a small program about your explanation.

Thank you for your valuable explanation,

Prem - you need to understand what static means, to start with. "Static" means "relating to the class, not to an object". A static field of a class is a value associated with the class, and not to any object of that class. An instance field is a property of a particular object.

An object has access to its own class fields - both static and instance - directly, and to other object's fields depending on the access settings of those objects.

This article has been dead for over six months. Start a new discussion instead.