Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Formal and Actual parameter.

 
sharma anurag
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

I hope that this was helpful to you ...

Best of luck ...
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When its time to *actually* pass the argument, whatever you pass at runtime is called as Actual Argument.

Whereas, the argument which is received to get the passed argument is called Formal Argument.

Does that help you?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's an interesting point you have noted Stan James.

Thanks for the updates with wikipedia link Marc.

 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic