Skip to main content

Im brand new, is the answers for Q and E: Variables wrong?

2 replies [Last post]
ceromus
Offline
Joined: 2008-08-16

Im thinking it is but at the same time since its so early in the tutorial and hasnt been fixed I may be completely mistaken.

Here is the question with answer:
A variable declared within the opening and closing parenthesis of a method is called a parameter.

Yet the website clearly states:
Local Variables Similar to how an object stores its state in fields, a method will often store its temporary state in local variables. The syntax for declaring a local variable is similar to declaring a field (for example, int count = 0;). There is no special keyword designating a variable as local; that determination comes entirely from the location in which the variable is declared — which is between the opening and closing braces of a method. As such, local variables are only visible to the methods in which they are declared; they are not accessible from the rest of the class.

Parameters You've already seen examples of parameters, both in the Bicycle class and in the main method of the "Hello World!" application. Recall that the signature for the main method is public static void main(String[] args). Here, the args variable is the parameter to this method. The important thing to remember is that parameters are always classified as "variables" not "fields". This applies to other parameter-accepting constructs as well (such as constructors and exception handlers) that you'll learn about later in the tutorial.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ceromus
Offline
Joined: 2008-08-16

Ohhh nevermind I see, A variable declared within the opening and closing [b]parenthesis[/b] of a method is called a parameter.

sfshaza
Offline
Joined: 2004-06-03

:-)