What a C/C++ programmers calls a function,we can call it as methods in Java.Both methods and functions are set of statements to perform certain tasks.The difference basically being that a method is a fancy term used to describe functions defined in classes that are called with instances of those classes that are objects.It's kind of like a bee is an insect but an insect is not necessarily a bee.A method is a function but a function is not necessarily a method.So method should declares and defines within the class only. It has access controlling mechanism used in oops.
Function declares and defines anywhere in the code,it has not access controlling and it is used in structured language.In more simple terms Method does not take any argument and it is invoked by method call where as function may or may not take the arguments.
So method is defined inside classes only. But if we take C++,we can write the functions inside as well as outside the class. So in C++ they are called member functions but not methods. Since java is a pure object oriented programming language, in order to write a program in java, we need at least one class. C++ is not a purely object oriented programming ,since it is possible to write programs in C++ without using a class or an object.
Comment for any doubts.....
So method is defined inside classes only. But if we take C++,we can write the functions inside as well as outside the class. So in C++ they are called member functions but not methods. Since java is a pure object oriented programming language, in order to write a program in java, we need at least one class. C++ is not a purely object oriented programming ,since it is possible to write programs in C++ without using a class or an object.
Comment for any doubts.....