473,503 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What Is The Difference Between Function And Method

1 New Member
What Is The Difference Between Function And Method
Jan 11 '08 #1
4 9052
r035198x
13,262 MVP
What Is The Difference Between Function And Method
The mathematicians that hang around this forum will probably tell you that a function is a method that returns exactly one value.
Jan 11 '08 #2
JosAH
11,448 Recognized Expert MVP
The mathematicians that hang around this forum will probably tell you that a function is a method that returns exactly one value.
There are different notions about functions and methods: a method in Java can
do what it wants: bake a cake for you, print "foo" on every paper page in your
printer until the printer is out of paper, attempt to format your harddisks and a
lot more usefull things. A function in Java can do the same but it must return
a value of a certain type.

A lot more restrictive (but very useful) functions are the 'referential transparent'
functions: those functions don't have side effects (no cake, no out of paper and
no fresh hard disks) and every time you call them with the same parameter
values they return the same value again and again. According to this definition
e.g. the Random.nextint() method is not a function.

Of course mathematics nags a bit further about, e,g. continuous functions,
bijective, injective, surjective functions, (primitive) recursive functions, computable
functions and the list goes on and on. Those mathematicians are loonies, there's
no need to pay any attention to them when you deal with Java.

kind regards,

Jos
Jan 11 '08 #3
BigDaddyLH
1,216 Recognized Expert Top Contributor
In Java, the preferred terminology is method. I don't know if the word "function" even appears in the Java Language Specification (JLS), although a Java programmer would know what you're talking about. Here is the relevant section, enjoy:

JLS: methods
Jan 11 '08 #4
RedSon
5,000 Recognized Expert Expert
Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

MODERATOR
Jan 14 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

220
18803
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
54
6502
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
9
1892
by: jlopes | last post by:
There seems to bet no diff between a vitual method and an inheirited method. class A_Base { public: virtual void filter(){ /* some code */ } }; class D_of_A_Base : public A_Base {
13
4997
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
4
39934
by: Rachel Suddeth | last post by:
What is the difference between a managed/unmanaged resource, and how do you tell which is which? I'm trying to understand how to write some Dispose() methods, and we are supposed to put code that...
9
2206
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see)...
13
1794
by: cashdeskmac | last post by:
I am a newbie to C# and have come across some VB .NET code in my studies. I notice that VB uses functions and subs, and was wondering what the difference was. Is it that one has a return value...
14
3767
by: Mohamed Mansour | last post by:
Hey there, this will be somewhat a long post, but any response is appreciated! I have done many PInvoke in the past from C++ to C#, but I did PInvoke within C# not C++/CLI. Can someone explain...
2
1424
by: Montezuma's Daughter | last post by:
Hi All I wanted to know what is the difference between: 1.getting an object the first worked for me and the other didn't var Subform = document.getElementById("Items2"); var Subform...
13
2709
by: Hussein B | last post by:
Hi, I'm familiar with static method concept, but what is the class method? how it does differ from static method? when to use it? -- class M: def method(cls, x): pass method =...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.