Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is a local variable?
Think about where the variable is declared.
Explain the significance of local scope.
Consider the dangers of accessible variables.
What will happen if you try to access a local variable outside its method?
Remember the definition of local scope.
Local variables are destroyed after their method execution ends.
Think about when memory is available for local variables.
Create a Java class that uses local variables in two different methods. Try to access the same variable in both methods and explain what happens.
Consider how variable declarations are scoped.
Write a method that demonstrates how a local variable can be shadowed by a parameter of the same name. What will be printed when you reference that name inside the method?
Think about how Java handles variable scopes.
1 more question in this section. Enroll free to practise them all.
Enroll free