Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is calling method and called method?

Are calling method and called method both same?

What I would like to know is "calling method" means the method which calls another method that is main method in most cases, or the main method itself?

like image 338
sarsarahman Avatar asked May 06 '12 10:05

sarsarahman


People also ask

What is difference between called and calling function?

Calling and Called Function ? The Function which calls another Function is called Calling Function and function which is called by another Function is call Called Function.

What does it mean to call a method?

When a method is invoked (called), a request is made to perform some action, such as setting a value, printing statements, returning an answer, etc. The code to invoke the method contains the name of the method to be executed and any needed data that the receiving method requires.

What is called method in Java?

A method is a block of code which only runs when it is called. You can pass data, known as parameters, into a method. Methods are used to perform certain actions, and they are also known as functions.

Can we call method in method?

Java does not support “directly” nested methods. Many functional programming languages support method within method. But you can achieve nested method functionality in Java 7 or older version by define local classes, class within method so this does compile.


2 Answers

The calling method is the method that contains the actual call; the called method is the method being called. They are different. For example:

// Calling method
void f()
{
    g();
}

// Called method
void g()
{
}
like image 97
Stuart Golodetz Avatar answered Oct 26 '22 09:10

Stuart Golodetz


The calling method is the method that contains the actual call.

The called method is the method being called. They are different.

They are also called the Caller and the Callee methods.

For example

int caller(){
int x=callee();
}

int callee(){
return 5;
}
like image 37
ConfusedAboutCPP Avatar answered Oct 26 '22 11:10

ConfusedAboutCPP