Results 1 to 4 of 4

Thread: differences

  1. #1

    differences

    what are differences between function and method?


  2. #2
    Junior Member
    Join Date
    Jul 2007
    Answers
    2

    Re: differences

    There is no difference. The distinction is that a method
    is attached to a class and a function is a stand alone part of code. Since it is an OO language, you can't have
    functions, which stand alone (outside of classes).



  3. #3
    Contributing Member
    Join Date
    Oct 2007
    Answers
    88

    Re: differences

    Quote Originally Posted by chandanavemulapally View Post
    what are differences between function and method?
    this is my suggestion only
    add();------>function
    add()
    {
    a+b;---->method
    a+c;---->method
    }
    one function we write functionality means method
    in c we call function
    in java we call method


  4. #4
    Contributing Member
    Join Date
    Nov 2007
    Answers
    46

    Re: differences

    method: it returns a value.
    ex: int add(int a,int b)
    { return a*b;}
    function: it doesn't return value
    ex: void add(int a,int b)
    { printf("%d%d" a,b); }


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