aspose file tools*
The moose likes Beginning Java and the fly likes Parameters and Arguments of a method. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Parameters and Arguments of a method." Watch "Parameters and Arguments of a method." New topic
Author

Parameters and Arguments of a method.

Sunali Anu
Greenhorn

Joined: Jun 04, 2007
Posts: 14
I want to know the difference between the two. If some body could please help me with this.. Thanks.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Hi,

Welcome to JavaRanch!

Most people use these two terms interchangeably, but there's a subtle difference in meaning. If you have a method like this:



then "x" is a parameter to the method. It's the variable listed in the declaration; whereas if you call the method like this



then "3" is an argument to the method call; it's the actual value passed in.


[Jess in Action][AskingGoodQuestions]
Bill Cruise
Ranch Hand

Joined: Jun 01, 2007
Posts: 148
They're used interchangably in a lot of instances but here's the difference. When you define a method (or function), you give it a parameter. When you call the method you pass it an argument.



Here param is a parameter.



Here 5 is the argument being passed.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I have sometimes seen Formal Parameter refer to the declaration, and Actual Parameter refer to the value passed.

http://chortle.ccsu.edu/CS151/Notes/chap34/ch34_3.html

There is just enough variety in usage to confuse us thoroughly. As long as a speaker or writer uses them consistently you can usually figger out what they mean sooner or later.


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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parameters and Arguments of a method.