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

parameter and arguments

 
Mathew Lee
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>> Note: Parameters refers to the list of variables in a method declaration. Arguments are the actual values that are passed in when the method is invoked. When you invoke a method, the arguments used must match the declaration's parameters in type and order.



I was reading above lines from link
http://download.oracle.com/javase/tutorial/java/javaOO/arguments.html

I have not clearly understood the difference between parameter and argument



Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public void foo (int i) { ... }       Here i is a parameter

foo(123);       Here i is passed as an argument
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15272
37
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The words "parameter" and "argument" are also often used for the same thing. There is no really meaningful difference.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic