0

What is the difference between procedure, method and function in java?

java

26th Mar 2017, 10:52 AM
Ghada Ahmed
Ghada Ahmed - avatar
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.
26th Mar 2017, 11:02 AM
Rax
Rax - avatar
+ 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.
26th Mar 2017, 1:38 PM
Hassie
Hassie - avatar