Why functions are called methods in java?
This question already has an answer here:
It's not in Java, it's an OOP name.
In sort, it defines part of the behavior of an instance of an object, not a general operation.
Every language has it's own syntax to differentiate from others. As for your question
Functions existence is independent.
Methods do not as they are created within the class.
Why functions are called methods in java?
For C++ it would depend on whether or not you're in a class.
In languages such as C++, functions are bits of code that will perform a particular action - but are not associated with an object. functions that are to do with an object are called methods. in java all functions are methods as they are all to do with objects.
上一篇: 功能和方法之间的区别
下一篇: 为什么函数在java中被称为方法?