Why local variable is preferred over global variable, JAVA Programming

Assignment Help:

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.


Related Discussions:- Why local variable is preferred over global variable

Determine the term- java is for real, Java Is For Real Java has a lot o...

Java Is For Real Java has a lot of hype however much of it is deserved. Java is very well matched for many modern problems Using more CPU time and memory but less programmer

Convert encrypted hsql database into csv format, Project Description: We...

Project Description: We have an encrypted HSQL Database which we need to convert into CSV format. HSQL DB . We have java application jar file which reads that database but no

Listening for roster and presence changes, The typical use of the roster cl...

The typical use of the roster class is to display a tree view of groups and entries along with the current presence value of each entry. As an example, see the image showing a Rost

A service locator, J2EE prepares use of the JNDI interface to access differ...

J2EE prepares use of the JNDI interface to access different resources like JMS, JDBC, EJB etc. The client finds up for these resources through the JNDI look-up. The JNDI look like

Functions in javascript, These are the central working units of JavaScript....

These are the central working units of JavaScript. Almost all the scripting code employs one or more functions to obtain the desired result. If you desire your page to provide cert

Create an interface with a method concatenation, a)  Using Java, create an ...

a)  Using Java, create an interface with a method called concatenation which will be implemented in the class patient in part b. b)  Using Java, write the class patient with the

Midlet game, do you have example of a simple midlet game ?

do you have example of a simple midlet game ?

Different messaging paradigms jms supports, What are the different messagin...

What are the different messaging paradigms JMS supports? Ans) Publish and Subscribe i.e. pub/suc and Point to Point i.e. p2p.

Development build to production server tomcat, Move development build to pr...

Move development build to production server tomcat Project Description: Move our development build and integrate with MYSQL database, to our production vps. The software i

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd