Website for the College study materials and cheats you can use

Translate

What is the difference between these two parameters? Discussing the concept of parameters, What are the parameters for?

Discussing the concept of parameters
A parameter is defined as a mechanism used for passing information into a subroutine(Eck, D. J. (2019) p 152). Since a subroutine is like a black box in which a user doesn’t need to know what is inside the subroutine before using it(Eck, D. J. (2019) p 141). And passing in a parameter is the only way to customize the behavior of a subroutine so as to adapt it to a particular situation (Eck, D. J. (2019) p 152).

 What are the parameters?

 A parameter is used to define the specification of a subroutine (Eck, D. J. (2019) p 152). Elaborately, it is used to pass in information to a subroutine (Eck, D. J. (2019) p 152).

They are two different types of Parameters in java programming.

 These parameters are Formal parameters and Actual parameters which is also called an argument.

 What is the difference between these two parameters?

 Formal parameters Are parameters that are used when defining a subroutine (Eck, D. J. (2019) p 152). It is important to know that are not values but they are much like a variable which means that these parameters must have a type when it is being defined. (Eck, D. J. (2019) p 152). Actual parameters: Are parameters that are used when calling a subroutine (Eck, D. J. (2019) p 153). These parameters are values and must respect the type of the formal parameter.

 Example of Actual and Formal parameters


In the code above the formal parameter is String name with String being the type of the parameter which is defined in the subroutine SayNmae.

and the actual parameter is the string "junior" that was passed in when we were calling the SayName subroutine.

We need to know that a subroutine when being defined can also have no formal parameter in this case when we call the subroutine no actual parameter will be passed in.


0 comments:

Post a Comment

Popular Posts

Categories

Contact Form

Name

Email *

Message *