Question
Why are there no global variables in java?

Answers

Global variables are considered bad form for a variety of reasons: Adding state variables breaks referential transparency (you no longer can understand a statement or expression on its own: you need to understand it in the context of the settings of the global variables), State variables lessen the cohesion of a program: you need to know more to understand how something works. A major point of Object-Oriented programming is to break up global state into more easily understood collections of local state, When you add one variable, you limit the use of your program to one instance. What you thought was global, someone else might think of as local: they may want to run two copies of your program at once. For these reasons, Java decided to ban global variables.   Your Comment




More Software,Java Questions..
What is the inputsplit in map reduce software?

Can variables be used in Java without initialization?

What is the difference between java bean and enterprise java bean?

What is software configuration management?

How does the java database connectivity (jdbc) work?

What are the advantages of threads in java?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

What is object cloning in Java?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?



Search
Can you Answer!!
  • Q Puerto Rico ceded to US by _________.
  • Q How can enable custom error, disable debug and disable trace in asp.net?
  • Q Which murderer lived at 39 Hilldrop Crescent, Kentish Town, North London?
  • Q What is design for manufacturability? How can it be realized in practice? Explain with an example.
  • Q What is the full form of RIDF
  • Q How can companies evaluate the board's effectiveness?
  • Q Is the shared source the same across the downloadable evaluation and emulation editions and "in the box"?
  • Q Why are component architectures useful?
  • Q automata DFA dia is given
  • Q Give an account on cold knife method and its applications.
  • Q Peter Potter in the USA and David Jacobs in the UK presented which pop music TV show?