#What is the difference between functions and methods in java?
Object-oriented language is called method
Process-oriented language is called function
There is no such thing as function in Java, only method. In fact, methods are functions, and functions are methods. They are just called different names in different languages.
[Recommended tutorial:Java Video Tutorial]
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, but there is no need to struggle with this concept. You will understand it naturally after using it more
Function, Procedure, Method, you can simply They treat it as the same concept: they are both 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.
The above is the detailed content of What is the difference between functions and methods in java?. For more information, please follow other related articles on the PHP Chinese website!