Hi to all my friends of javaranch.!!! I want to know what is the basic diffrence between formal and actual parameter? Thanks in advance.!!! :roll:
Vassili Vladimir
Ranch Hand
Joined: Mar 08, 2007
Posts: 1585
posted
0
Hi,
suppose that you have the following code snippet :
From the code snippet above, the value 1 passed from the main method to the doIt() method is the actual parameter, and the toDo parameter in the doIt() mrthod is the formal parameter, sometimes it's also called the dummy parameter.
Note that one reply above used "parameter" and the other used "argument" for both actual and formal. Google up on the terms and see if you think either or both were correct. Sometimes you'll see parameter used for the formal and argument used for the actual.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
The distinction is arguably subtle (no pun intended), and I have to admit I'm not as careful with these words as I should be. Interestingly, Wikipedia redirects "argument" to the entry for "parameter," which discusses both words.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Based on my inferences, i also feel that "parameter" is what you declare in the function prototype and "argument" is the value what you actually pass at runtime.
But as marc said, many people tend to use these terms interchangably. [ September 03, 2007: Message edited by: Raghavan Muthu ]