This is probably better suited to my other thread about the return statement, but this is a new (quick) question, so I’m just going to put it here. Real quick, is a function the same as a method or are they different? Thanks.
There are no functions in Java only methods.
Basically… functions and methods are the same. The difference is that methods are always bound to objects. So, you got functions in functional languages and methods in OO languages.
technically, a function always returns the same value so
public Date now() {
return new Date();
}
is not a function, but that’s just a formality
While you can find different definitions, and you could use google for that question, here is my version:
Basically there is no relevant difference. But I once heard the definition that a function returns something and a method does not. The method just does something while a function produces a result.
After all, it doesnt matter. Usually, no one makes a difference there, so you can use either word or both.
-JAW
“Function” is a math term that pretty much got hijacked by computer scientists (who were mathematicians). A function takes a value from a set as an argument and produces a value from another set as a return value (with some restrictions that I can’t remember as well as I should).
In computer science, function and method are used almost interchangeably, like the others said. In either case, it’s an algorithm that is performed and may optionally return a value. It’s not really the same as a math function because computer science functions/methods can do other things besides return a value (e.g. they can draw something on the screen).
So functions and methods the same, but you should call them methods to avoid confusion with people you probably won’t talk to anyways. Or, at least, that’s my understanding of why Java has “methods” instead of “functions”.
I remember my first programming language, Turing.
There was procedures and functions, the diference was that procedures didn’t return a value, and functions did.
That was easily translated in my mind to any function v/s void functions in my C days.
Now in Java my experience says that all are methods, bound to objects and classes (statics).
Methods is antoher word for functions
Let’s leave it to that shall we? 
Well the difference is good to know, some methods are functions, while some are procedures. Think that you could create a function that takes (say) a map and two points and returns a list of paths between the two points of minimal lengths. On the other hand you can have a procedure that performs operations on the map to highlight the shortest paths between the two points.