0
What is the difference between procedure, method and function in java?
java
2 Answers
+ 2
- I think a procedure is a generic name to do any task, like an algorithm.
- Function is the set of statements which is made to perform a particular task.
- A method is same as function, every function defined within the class is called a method (i mean, the member function of a class is also known as method).
But in jave everything is defined within the class, so method must be purely equivalent to a function.
+ 2
A procedure is a block of code that runs without returning a value.
A function runs a block of code and returns a value.
A method is the Java equivalent of a function or procedure.