why local variable is preferred over global


Why Local variable is preferred over Global variable ?

In my point of view Global variable has a few advantage along with Local variables is preferred because of the subsequent reasons:-
When we declare any global variable within web page then in case of error and logic it's extremely difficult to see on that line this variable is used and what's his value if we have more than 2000 lines and all the functions in web page using that Global Variable so Global variables could form the logic of a Web page hard to understand.

As we know we can use Global variable everywhere so global variables also form the reuse and manages of your code much more complex.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: why local variable is preferred over global
Reference No:- TGS0284016

Expected delivery within 24 Hours