Results 1 to 13 of 13

Thread: Differences Between Method and Function

  1. #1
    Junior Member
    Join Date
    May 2008
    Answers
    1

    Differences Between Method and Function

    can any one explain clearly what is the difference between the Method and a Function, if possible by using some syntax and examples.


  2. #2
    Junior Member
    Join Date
    Nov 2006
    Answers
    5

    Re: Differences Between Method and Function

    no difference according to me...

    method is OO concept related to class
    i.e. function written for a class = method

    this is my wild guess...
    as per my knowledge it hardly makes any difference.


  3. #3
    Junior Member
    Join Date
    Aug 2008
    Answers
    15

    Re: Differences Between Method and Function

    Hi,
    method should declares and defines within the class only. so it has access controlling mechanism. used in oops.
    function declares and defines anywhere in the code. it has not access controlling. used in structured language.
    even behavior is same.

    thanks


  4. #4
    Expert Member
    Join Date
    Jun 2007
    Answers
    260

    Re: Differences Between Method and Function

    hi,

    In java function is call itself as a method.... there is not any difference in those thng.... it just using of terms...like in c++ we call it functins..and in java we call it as methods. In more simple terms Method does not take any arguement and it is invoked by method call
    whereas function may or may not take the arguements?
    Also Method does't return any thing but the function can return any thing

    Thanks
    Sushma


  5. #5
    Junior Member
    Join Date
    Aug 2008
    Answers
    1

    Re: Differences Between Method and Function

    both r same but method does't return any thing and function returns any thing


  6. #6
    Junior Member
    Join Date
    Sep 2008
    Answers
    1

    Re: Differences Between Method and Function

    Hi,
    method should declares and defines within the class only. so it has access controlling mechanism. used in oops.
    function declares and defines anywhere in the code. it has not access controlling. used in structured language.
    even behavior is same.

    thanks


  7. #7

    Re: Differences Between Method and Function

    Function and Method both are same. But if it is declared outside of class it is function and if it is declared within class that is method.
    In case of C++ it will support both functions and methods
    But In case of Java there is no Functions concept only method is alloed.


  8. #8
    Junior Member
    Join Date
    Oct 2008
    Answers
    1

    Re: Differences Between Method and Function

    Quote Originally Posted by pramodh852 View Post
    both r same but method does't return any thing and function returns any thing
    hi,
    look friend, according to u method does not return any value is like a wrong concept because it returns the value in java.
    thanks


  9. #9

    Talking SIVA REDDY: Differences Between Method and Function

    METHODS FUNCTIONS
    1.METHODS CALLED BY REFERENCE 1.FUNCTIONS DO NOT HAVE ANY REFERENCE
    VARIABLES VARIABLES
    2.METHOD DOES NOT RETURN VALUE 2.FUNCTION GIVES RETURN VALUE
    AS SUBROUTINE(OR) PROCEDURE
    3.IT IS IMPLICITLY PASSED THE 3.ALL DATA THAT IS PASSED TO A FUNCTION
    OBJECT FOR WHICH IT WAS CALLED IS EXPLICITLY PASSED
    4.IT HAS ACCESS CONTROLLING 4.IT HAS NOT ACCESS CONTROLLING i.e.,METHOD SHOULD MECHANISM i.e.,FUNCTION DECLARES AND
    DECLARES AND DEFINES IN THE DEFINES ANY WHERE IN THE CODE
    CLASS ONLY


  10. #10

    Re: Differences Between Method and Function

    SIVA REDDY(ANITS- 3/4 IT): Differences Between Method and Function
    METHODS :

    1.METHODS CALLED BY REFERENCE VARIABLES
    2.METHOD DOES NOT RETURN VALUE AS SUBROUTINE(OR) PROCEDURE
    3.IT IS IMPLICITLY PASSED THE OBJECT FOR WHICH IT WAS CALLED
    4.IT HAS ACCESS CONTROLLING i.e.,METHOD SHOULD DECLARES AND DEFINES IN THE CLASS ONLY

    FUNCTIONS:
    1.FUNCTIONS DO NOT HAVE ANY REFERENCE VARIABLES
    2.FUNCTION GIVES RETURN VALUE
    3.ALL DATA THAT IS PASSED TO A FUNCTION IS EXPLICITLY PASSED
    4.IT HAS NOT ACCESS CONTROLLING i.e.,FUNCTION DECLARES AND DEFINES ANY WHERE IN THE CODE


  11. #11
    Junior Member
    Join Date
    Aug 2010
    Answers
    1

    Thumbs down Re: Differences Between Method and Function

    Quote Originally Posted by nikku.aryan View Post
    hi,
    look friend, according to u method does not return any value is like a wrong concept because it returns the value in java.
    thanks
    hey! dude u r right, method returns value....
    Check the program

    public class Hello {
    public static int a() {
    System.out.println("Hello to the World of OOPs....!");
    return 0;
    }
    }

    this method returns the value...


  12. #12
    Contributing Member
    Join Date
    Jun 2010
    Answers
    55

    Re: Differences Between Method and Function

    The terms method, function, procedure, subroutine, and subprogram are all roughly synonymous, although the term function is generally reserved for a subroutine that returns a value. Some languages like Fortran use slightly different syntax to define functions vs. procedures. For my part, I tend to use method when I'm talking about a subroutine that's a class member and function for subroutines that aren't class members, regardless of whether they return a value or not.


  13. #13
    Junior Member
    Join Date
    Oct 2011
    Answers
    2

    Re: Differences Between Method and Function

    Quote Originally Posted by siva reddy gadu View Post
    SIVA REDDY(ANITS- 3/4 IT): Differences Between Method and Function
    METHODS :

    1.METHODS CALLED BY REFERENCE VARIABLES
    2.METHOD DOES NOT RETURN VALUE AS SUBROUTINE(OR) PROCEDURE
    3.IT IS IMPLICITLY PASSED THE OBJECT FOR WHICH IT WAS CALLED
    4.IT HAS ACCESS CONTROLLING i.e.,METHOD SHOULD DECLARES AND DEFINES IN THE CLASS ONLY

    FUNCTIONS:
    1.FUNCTIONS DO NOT HAVE ANY REFERENCE VARIABLES
    2.FUNCTION GIVES RETURN VALUE
    3.ALL DATA THAT IS PASSED TO A FUNCTION IS EXPLICITLY PASSED
    4.IT HAS NOT ACCESS CONTROLLING i.e.,FUNCTION DECLARES AND DEFINES ANY WHERE IN THE CODE

    In C++ functions are also called using reference variables only..


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact