Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between parameters and attributes [duplicate]

Tags:

java

servlets

Possible Duplicate:
Difference between getAttribute() and getParameter()

I read parameter and attributes as two different topics in j2ee. But I am not able to realize the difference. Can any one clarify?

like image 779
satheesh Avatar asked Jul 19 '11 07:07

satheesh


People also ask

What is the difference between attribute and parameter?

An attribute is a variable of any type that is declared directly in a class. A parameter is a variable defined by the function that receives a value when it is called. An attribute is used with classes and objects. A parameter is used with a function or a method.

What is difference between parameters and arguments?

The values that are declared within a function when the function is called are known as an argument. Whereas, the variables that are defined when the function is declared are known as a parameter.

What is the difference between a parameter and an argument Linkedin?

Parameter is the variable in the declaration of the function. Argument is the actual value of this variable that gets passed to the function.

What is the difference between a parameter and a function?

Note the difference between parameters and arguments: Function parameters are the names listed in the function's definition. Function arguments are the real values passed to the function. Parameters are initialized to the values of the arguments supplied.


2 Answers

Objects have attributes which basically is ,their data members. The operations defined on an object which are called as method in JAVA, have parameters in their parantheses, on these parameters the functions operate upon .

like image 121
BabloBko Avatar answered Nov 07 '22 16:11

BabloBko


Parameters come from the client request. Example: http://google.com?q=1

Here q is a parameter.

Attributes are set by the server side. For example, you can set a session or request attribute called userId to indicate the current user.

like image 39
Abdullah Jibaly Avatar answered Nov 07 '22 16:11

Abdullah Jibaly