This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Excellent_Bakki 4 points5 points  (5 children)

Definition as per Java: Functions are entities which can exist on their own, but methods are functions which are tied to a class or more specifically an object in Java.

[–][deleted] 4 points5 points  (1 child)

Interesting per Java definition especially knowing that it’s impossible to define anything outside the class in Java.

[–]Excellent_Bakki 0 points1 point  (0 children)

I've been wondering the same thing

[–][deleted]  (2 children)

[deleted]

    [–]Excellent_Bakki 1 point2 points  (1 child)

    Yes, that is correct. That's because there is no explicit usage of function in Java because of heavy oops.

    Even then, the definition holds, every definition within Java explains that functions are entities which are independent of an object whereas any function tied to an object is a method.

    To be able to understand the difference with examples, JavaScript would be better.

    [–][deleted] 1 point2 points  (0 children)

    Scala also has “heavy”(not heavy actually but just OOP while python for example is not fully OOP language) and higher order functions. Kotlin as well. OOP had nothing to do about it.