Why there are no global variables in java?
-
Please answer my question in detail..
-
Answer:
You have asked this question in wrong section. You must go to the Computers & Internet Section > Programming and Design. There you can find your answer. ---------------------------------------… However, I am answering your question. I Hope you would get it. Global variables do not live well with OOP. Still one can have constants as global variables If you really want to declare global variable, make it a public static variable A simple way to utilize "global" variables in Java is to define a class Global with the desired variables as static members of it: public class Global { public static int x = 37; public static String s = "aaa"; } Such members can be accessed by saying: public class test { public static void main(String args[]) { Global.x = Global.x + 100; Global.s = "bbb"; } } =======================================…
Cutie at Yahoo! Answers Visit the source
Other answers
variables....................... ip ............................... 12th ........................... exam ..................... tenson .......................... cry ........................................…
Related Q & A:
- What is the dangers of Global Variables in Drupal specifically?Best solution by Quora
- How can I pass global variables into a function?Best solution by Stack Overflow
- Why some companies refuse to go global?Best solution by answers.yahoo.com
- The global warming, how and why it began?Best solution by wattsupwiththat.com
- Why am I having this problem with java or Windows Installer?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.