0
Why global variable concept not there in java ??
2 Answers
+ 2
CHAVVA RAGHUNATHA REDDY
Technically not possible but You can declare at the start of the code.
0
In Java, the smallest separate structural unit is a class. The code begins to be written by writing a class where everything is encapsulated, which is an OOP requirement.
In scripting languages, such as Python, where you can start writing code from 1 variable directly to the command line interpreter, global variables are needed because their future scope is unknown.