Object-oriented languages are called methods, and process-oriented languages are called functions.
There is no such thing as a function in Java, only a method. In fact, methods are functions, and functions are methods. They are just called different names in different languages.
Tell you how to distinguish functions and methods in one sentence: functions are our functions, and methods are methods of classes.
How to distinguish whether an ITer is a designer or a coder. See if he is adjusting other people's libraries, or writing his own JAR package to share with others.
It feels like it’s not just a level difference.
A thing is called a method when called with an object, and a function when called directly by the function name.
C language and other languages are called functions. In object-oriented programming, functions written into a class are called methods. Functions can be called directly. Methods in objects generally have the pointer this pointing to it, but sometimes some methods really don’t. It needs to be written into the class, so object-oriented languages have static methods. However, there is no need to get entangled with this concept. You will naturally understand it after using it more.
Function, Procedure, Method, you can simply think of them as the same concept: they are all an executable code body composed of several statements.
Function: Function (the original English version of the procedural language tutorial, is there anyone who translates Function into Method?)
Method: Method (Only unauthentic object-oriented language tutorials will translate Method is called Function)
means the same thing. It may be that methods are more focused on classes, which is object-oriented design. They focus on the functions of each function, so they are called methods; while functions are more process-oriented, and may be functional descriptions. It may or may not be the case. It depends on how the programmer sees it.
PHP Chinese website has a large number of free JAVA introductory tutorials, everyone is welcome to learn!
The above is the detailed content of What are the differences between java methods and functions?. For more information, please follow other related articles on the PHP Chinese website!