• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

argument or parameter? attribute or property?

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 563
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From a SCWCD perspective parameter should be seen as the parameter in an HTTP request query.
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the definition given by Seema makes a lot of sense - what else are you looking for?
reply
    Bookmark Topic Watch Topic
  • New Topic