What is the scope of any variable?

1 answer

Answer

1151709

2026-08-19 06:15

+ Follow

The Scope of a variable defines the areas of a program where this variable would be visible and can be used. For ex:

a. Method variables - are visible only inside the method where they are declared and hence their scope is only the method

b. Class variables - are visible inside the class and can be used by any method inside the class and hence their scope is the whole class.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.