What is the difference between methods and functions?

This question is related to TCS Interview

Showing Answers 1 - 57 of 57 Answers

kishore

  • Sep 19th, 2006
 

Methods are calling using objects.

FUNCTIONS ARE DIRECTLY CALLING

sreelekha

  • Sep 24th, 2006
 

methods are invoked using objects.

wheres as in case of functions here is no quesion of objects.

we can it directly

  Was this answer useful?  Yes

srinivas Y

  • Nov 8th, 2006
 

 The major difference between methods and functions is that methods called by the reference variables called objects where as the functions do not having any reference variables.

user

  • Jun 24th, 2009
 

Function have independent existence which means they are defined outside the class. Method do not have independent existence that means they are defined inside the class.

zyduss

  • Jun 26th, 2009
 

The major difference between methods and functions is that methods called by the reference variables called objects where as the functions do not having any reference variables.

jirolu

  • May 13th, 2010
 

It is where about return or not return value

Method -> does not give return value, as subroutine or procedure
Function -> gives return value

  Was this answer useful?  Yes

avula chiru

  • Sep 30th, 2010
 

The name methods are used in the language Java, in this language we called functions are the methods but in C language we simply called these are functions, because the Java contains class and objects. Methods are called by object variable.

  Was this answer useful?  Yes

tapassaha

  • Nov 6th, 2010
 

The major difference between methods and functions is that methods called by the reference variables called objects where as the functions do not having any reference variables.

KESHAV KUMAR

  • Jul 18th, 2011
 

Method and function are the same thing but their are minor difference between them. these difference are :

function return some value but method doesn't return anything .

function have return type but method has no return type

But we can use both the same things .

Example :
some books prefer that strlen() function And some books

Code
  1.  

  2. prefer  strlen() method .

  3.  

  Was this answer useful?  Yes

Mani Prakash

  • Aug 6th, 2011
 

Let me explain the difference between the method and function.

Method is used to for doing the things especially in a systematic way implies an orderly logical arrangement.

The function is a self-contained block of statements that perform a coherent task of some kind.

  Was this answer useful?  Yes

both methods and functions are set of statements to perform certain tasks...

when it places inside the class it is called as methods. methods are used to call by using objects and we can pass references as parameter.Ex. c++,java

if it is placed inside main function called as functions. function is called directly by the main program and doesn't use references. Ex c language functions

  Was this answer useful?  Yes

nivas310

  • Aug 17th, 2011
 

What a C/C++ programmers calls a function,we can call it as methods in Java.
We can insert functions into methods,but we cannot insert methods into functions.

  Was this answer useful?  Yes

Ajmal

  • Aug 30th, 2011
 

I don't think so. Only the constructor do not have a return type. All other methods should have return type.

And I believe that the functions inside a class is termed as method.

I'm sorry if this is wrong

  Was this answer useful?  Yes

yatin

  • Sep 6th, 2011
 

methods is a calling procedure
function is a small program

  Was this answer useful?  Yes

MEGHA GUPTA

  • Sep 11th, 2011
 

Methods are functions only which have defined classes they are in JAVA and C#..
functions are in C

  Was this answer useful?  Yes

jeba christopher

  • Sep 30th, 2013
 

In c language we indicate the main function outside the class

eg. class cse

Code
  1. {

  2. ..............//stmt;

  3. };

  4. void main()

  5. {

  6. cse c;

  7. c.functionname();

  8. }

  9.  

  10. method :

  11.       In java we indicate the main function only inside the class declare

  12. eg...

  13.  import java.io;

  14. public class cse

  15. {

  16. void display()

  17. {

  18. .......//stmt;

  19. }

  20. public static void main(String []arg)

  21. {

  22. cse c=new cse();

  23. c.display();

  24. }

  25. }

  26.  

  Was this answer useful?  Yes

aniket

  • Dec 12th, 2014
 

Method can automatically call as constructor.

  Was this answer useful?  Yes

lavanya

  • Aug 24th, 2015
 

Please can you explain clearly about independent existence?

  Was this answer useful?  Yes

lalitha

  • Sep 18th, 2015
 

A function is a self-contained program segment that performs a particular task.
I mean method are one generally used to define functions in a class, where several types of users access right like public, private and protected can be defined.

  Was this answer useful?  Yes

sandeep singh rawat

  • Oct 13th, 2015
 

A function was used in C/C++. However with the Java the name "method" is used in place of function that is all.

  Was this answer useful?  Yes

Shylendar

  • Dec 26th, 2016
 

Simple Difference:
1. Inside the class you can write method()
2. Outside the class you can write function()
3. Function have return type.
4. Method don't have return type.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions