0 votes
in JAVA by

Why there are no global variables in Java?

1 Answer

0 votes
by

Global variables are globally accessible. Java does not support globally accessible variables due to following reasons:

The global variables breaks the referential transparency

Global variables creates collisions in namespace.

Related questions

0 votes
asked Feb 9, 2021 in JAVA by SakshiSharma
+2 votes
asked Jul 27, 2021 in JAVA by SakshiSharma
...