Let's assume you have a method call, and a method, like this:
// In the main program:
int x = 5;
myMethod(x, 10)
...
// Some lines later:
void myMethod (int parameter1, int parameter2)
{
// Do something here
}
The arguments - values 5 and 10 - are passed to the method, myMethod. This means a copy of these values is passed to the method, for its use. (Technically, the values are placed on the stack, where the other method accesses them.)
The method will then have the values available. This allows for a method to be flexible, being able to processes different sets of data. For example, instead of writing a method to calculate the square root of 2, you write a method that calculates the square root of any number - passed as an argument.
Copyright © 2026 eLLeNow.com All Rights Reserved.