File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

argument or parameter? attribute or property?

 
William Yan
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,
I can't distinguish between argument and parameter, attribute and property.
Drop me a light on it.

Thank you in advance.
William.
 
Seema Ahuja
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This is a very common question asked by most people learning java and jsp & servlets.
well to put it in plain language :

argument: is what you pass to a method while calling it e.g: M.myfunction("xyz") here xyz becomes the argument to the method myfunction()

parameter: is what the method accepts as an input when called. ie: public void myfunction(String s) here String s is a String "parameter" of the function mufunction

Attribute: Attribute is value that you set in a scope eg: request scope, conext scope or page scope. This atrribut can be an onject and that object has properties.
for example you can set object person in the request scope that has a property named "name".

eg:

here : p is an attribute and name is it's property.

Hope that explains.
 
William Yan
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Seema,

But I don't think i really catch the difference between argument and parameter.
What if the term 'argument' or 'parameter' is used both by the method or by someone that invokes the method? Everything is OK. Isn't it?
 
Bachi Taurean
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi william,

Arguments tell us what is the value that you are giving. Parameters tell us which type (data type)of value is expected from the caller. Seema am i right?
 
William Yan
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bachi,
I get something, but i'm not sure.
The difference is subtle, I think.
Argument is a variable that you pass to the method, it should be decided by compile time, though it may have different values in runtime.
Parameter is just used as a local variable in a method.
 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a SCWCD perspective parameter should be seen as the parameter in an HTTP request query.
 
Siddharth Purandare
Ranch Hand
Posts: 101
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey William,

Let me know if this helps!!!

::::1:::

Attributes can be set with setAttribute(String,Object)
Parameters CANNOT be set (Only read once from DD-Web.xml)

:::2:::

Attributes are retrieved by getAttribute()
parameters can be retrived by getInitParameter() from DD-Web.xml

:::3:::

Attribute's return type is Object
Parameter's return type is String.
 
William Yan
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Siddharth,

I agree with you, but i really want to know the difference between argument and parameter.

Thank you.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the definition given by Seema makes a lot of sense - what else are you looking for?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic