Why there are no global variables in java?



Why there are no global variables in java?..

Answer / Varun Kumar Saxena

In Java, there are no global variables in the traditional sense. Instead, variables are declared within methods or classes and have their scope limited to those method or class. This helps in encapsulating data, promoting modular programming, and reducing conflicts between variables.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Java Related AllOther Interview Questions

What is web container in java?

1 Answers  


Why do we need new date and time api in java se 8?

1 Answers  


What do you mean by exception handling?

1 Answers  


How do I run a java project?

1 Answers  


What do I need to install netbeans?

1 Answers  


What is java persistence api used for?

1 Answers  


What is the locale class?

0 Answers  


Is php faster than java?

1 Answers  


What is jsr in java?

1 Answers  


Is lambda functional programming?

1 Answers  


I have deployed a .war file in my application server comprising of struts and hibernate.If i want to change the "dialect" property of hibernate cfg file how can i change(I have only .war file)... Thanks in advance

1 Answers  


I run a web server. Am I at risk? : java security

1 Answers  


Categories