7 Years
Discussion Span
Last Post by JamesCherrill

As you have posted this in the Java Forum I assume your questions relates to the Java Language.

Well talking about functions and methods:
Functions are a block of code that are perform a specific task and return a value. These help in modularizing code into logical pieces. They also help in sprucing-up (trimming) the code as a function can be called from various places and the same code need not be written in different places hindering the readability of the code. Also since the code is not repeatitively written in many places maintenance is easy, as you just have to fix a bug (or make a change) in one place instead of many.

In Java, functions are referred to as "methods". Other langauges such as C, C++ etc prefer to call them functions.

Procedures : Procedures may perform several different tasks. Although I don't remember this distinction being made in programming langauges atleast. Sometimes functions may also be referred to as procedures, as you may have heard some lanaguages, which are modularized on functions, such as C being called procedure oriented langauges or procedural langauges.

Refer to the INTERNET for more.


Re procedures - they are a sequence of steps that implement something useful. (As opposed to non-procedural languages such as HTML that describe the required results but do not give step-by-step instructions on how to achieve them). Java is procedural, and all procedures are implemented in methods (*).
So one answer to your question is "none". Java just has methods, that implement procedures, and may implement functions (if they return a result)
(*) OK, for the real Java buffs, there are also static initialisers

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.