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!
How does IntelliJ IDEA identify the port number of a Spring Boot project without outputting a log?Apr 19, 2025 pm 11:45 PMStart Spring using IntelliJIDEAUltimate version...
How to elegantly obtain entity class variable names to build database query conditions?Apr 19, 2025 pm 11:42 PMWhen using MyBatis-Plus or other ORM frameworks for database operations, it is often necessary to construct query conditions based on the attribute name of the entity class. If you manually every time...
Java BigDecimal operation: How to accurately control the accuracy of calculation results?Apr 19, 2025 pm 11:39 PMJava...
How to use the Redis cache solution to efficiently realize the requirements of product ranking list?Apr 19, 2025 pm 11:36 PMHow does the Redis caching solution realize the requirements of product ranking list? During the development process, we often need to deal with the requirements of rankings, such as displaying a...
How to safely convert Java objects to arrays?Apr 19, 2025 pm 11:33 PMConversion of Java Objects and Arrays: In-depth discussion of the risks and correct methods of cast type conversion Many Java beginners will encounter the conversion of an object into an array...
How do I convert names to numbers to implement sorting and maintain consistency in groups?Apr 19, 2025 pm 11:30 PMSolutions to convert names to numbers to implement sorting In many application scenarios, users may need to sort in groups, especially in one...
E-commerce platform SKU and SPU database design: How to take into account both user-defined attributes and attributeless products?Apr 19, 2025 pm 11:27 PMDetailed explanation of the design of SKU and SPU tables on e-commerce platforms This article will discuss the database design issues of SKU and SPU in e-commerce platforms, especially how to deal with user-defined sales...
How to set the default run configuration list of SpringBoot projects in Idea for team members to share?Apr 19, 2025 pm 11:24 PMHow to set the SpringBoot project default run configuration list in Idea using IntelliJ...


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools






