posted 14 years ago
every instance variable or method is considered to be the property of an object of that class.
here countGold method will be a property of an object not that of the class hence an object is indispensable to invoke it.
since static methods does not have a this (as they are the property of the class not of any object)
hence we can't call or invoke a non-static method from static one . also we can't use any non-static variable too from a static method .
hence we must need an object to invoke the method or to use an instance variable.
avi sinha