Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes argument or parameter? attribute or property? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "argument or parameter? attribute or property?" Watch "argument or parameter? attribute or property?" New topic

argument or parameter? attribute or property?

William Yan
Ranch Hand

Joined: Sep 26, 2006
Posts: 69
Hi ranchers,
I can't distinguish between argument and parameter, attribute and property.
Drop me a light on it.

Thank you in advance.

Java is better and better, yet bitter and bitter.
Seema Ahuja
Ranch Hand

Joined: Feb 01, 2006
Posts: 32

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".


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

Hope that explains.
William Yan
Ranch Hand

Joined: Sep 26, 2006
Posts: 69
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

Joined: Aug 03, 2006
Posts: 26
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?

Success is never ending and Failure is neve Final
William Yan
Ranch Hand

Joined: Sep 26, 2006
Posts: 69
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

Joined: Jun 28, 2003
Posts: 547

From a SCWCD perspective parameter should be seen as the parameter in an HTTP request query.

SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCBCD 5
Visit my blog
Siddharth Purandare
Ranch Hand

Joined: Nov 13, 2006
Posts: 101
Hey William,

Let me know if this helps!!!


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


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


Attribute's return type is Object
Parameter's return type is String.

Siddharth Purandare<br />SCJP 1.4 - 76%<br />SCWCD 1.4 - 85%<br /> <br />It is the "attitude" and not the "aptitude" which determines "altitude".
William Yan
Ranch Hand

Joined: Sep 26, 2006
Posts: 69
Hi Siddharth,

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

Thank you.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41173
I think the definition given by Seema makes a lot of sense - what else are you looking for?

Ping & DNS - my free Android networking tools app
I agree. Here's the link:
subject: argument or parameter? attribute or property?
Similar Threads
Problem in Creating Dynamic Link from Display Table
jsp:setProperty question
Difference between attribute and parameter
Using checkBoxlist in struts2
how to set a ArrayLIst property of form from jsp