+ 1

What is the difference between function and method in java

13th Aug 2017, 11:53 AM
Vaibhav Singh Sikarwar
Vaibhav Singh Sikarwar - avatar
3 Answers
+ 2
A function returns a value. A method does not, it just runs declared statements.
13th Aug 2017, 12:17 PM
Hassie
Hassie - avatar
+ 3
Method is a member of class
13th Aug 2017, 12:35 PM
Roman
Roman - avatar
+ 3
A function is outside a class, while a method is inside a class. Method is the term you will hear for OOP. @Hassie NO. A method can certainlly return a value.. class aClass{ int myMethod(){ return 1; } } Java does NOT have functions.
13th Aug 2017, 3:10 PM
Rrestoring faith
Rrestoring faith - avatar