A method is on an object.
A function is independent of an object.
For Java, there are only methods.
For C, there are only functions.
For C++ it would depend on whether or not you’re in a class.
In general: methods are functions that belong to a class, functions can be on any other scope of the code so you could state that all methods are functions, but not all functions are methods:
Take the following python example:
print 'hello stranger'
a_door = Door()
def orphan_function() :
print “I am not part of class so can never be called method”
The example given shows you a class called “Door” which has a method or action called “open”, it is called a method because it was declared inside a class. There is another portion of code with “def” just below which defines a function, it is a function because it is not declared inside a class, this function calls the method we defined inside our class as you can see and finally the function is being called by itself.