Not convinced. “Attribute” is not a standard word in Java™ jargon. The nearest I can think is that you are talking about the attributes of an object, which means the values of its fields. But some people would use it with a wider meaning, including behavioiur (its methods) in that term too.
In the example shown, name is the method parameter and "Ravi" is an argument passed to that method. In that instance there is specific Java™ jargon.
Unless you're specifically talking about servlets? There there's a particular distinction. For instance, a request parameter is a read-only string that is passed in from the URL arguments, and a request attribute is a request-scoped object that can be added to the Request object by the servlet (and then accessed elsewhere).
If you're talking in general terms, in object-oriented design (not specifically limited to Java) attributes are the properties of a conceptual class, which (usually) end up corresponding to the fields of the corresponding Java (or whatever language) class.
Joined: Oct 13, 2005
I didn’t think we were talking about servlets. I think you, Matthew, and I are in agreement here.
Campbell Ritchie wrote:I didn’t think we were talking about servlets. I think you, Matthew, and I are in agreement here.
No, I didn't think we were either (it ought to have been in the servlet forum if that was intended!). But I've seen the question asked in that context before quite a few times, so I thought I'd mention it in case.
Joined: May 31, 2011
Campbell Ritchie wrote:In the example shown, name is the method parameter and "Ravi" is an argument passed to that method. In that instance there is specific Java™ jargon.
Yes - I think I made a mistake in my understanding of swapping them both. Thanks Campbell!
subject: Difference between attributes and parameters