answersLogoWhite

0

In Java, there are three kinds of variables: local variables, instance variables, and class variables. Variables have their scopes. Different kinds of variables have different scopes. A variable is shadowed if there is another variable with the same name that is closer in scope. In other words, referring to the variable by name will use the one closest in scope, the one in the outer scope is shadowed.

A Local Variable Shadows An Instance Variable

Inside a class method, when a local variable have the same name as one of the instance variable, the local variable shadows the instance variable inside the method block.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Where can one find more information about shadowing?

There are quite many things that the word "shadowing" may refer to. It can be file shadowing, job shadowing, projective shadowing, variable shadowing, or speech shadowing. Information about all above shadowing related things can be found in wikipedia.


What is native variable in java?

native is a key word used in java method. there is no variable as native in java


How you make shared and synchronized variable in java thread?

A Variable that is shared as well as synchronized cannot be created in Java. These two terms are mutually exclusive and a variable that is synchronized in java cannot be shared and vice versa


What is the syntax of global variable in java?

There's no global variables in Java.


What is a variable type in Java?

int


Can you define variables in interface in java?

yes we can define a variable in an interface in java.


What is the code required to convert an integer variable to a string variable in Java?

There are several different methods to convert an integer variable to a string variable in Java. For example, one can use the following code to convert an integer variable to a string variable: Integer.toString(number)


How do you equate a php variable to a javascript variable?

Ideal thing would be to retrieve the value from PHP using AJAX and then assigning it to a java script variable. Thereafter compare it to the java script variable that is already present.


Can a java program has two different variable?

Yes. You can have as many variables as you want in Java


What is instance variable in java?

That refers to a variable attached to an object - also known as a field.


What is the meaning of a method in Java programming?

a method is a variable


How do you increase a variable by 5 in Java?

variable_name=variable_name+5;