Home > Java > javaTutorial > What are the differences between java methods and functions?

What are the differences between java methods and functions?

爱喝马黛茶的安东尼
Release: 2019-12-27 13:17:08
Original
4599 people have browsed it

What are the differences between java methods and functions?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template