It depends. The question is not clear enough to give a yes / no answer in my opinion.
If an application somehow expands this variable, then naturally other applications may just ask for a value. But this is unlikely what the question should have been raised. But keep that in mind. In the interview, I was always pleased to prove that you can think critically and out of the box.
I suppose they wanted to see if you understood the concept of static variables and ClassLoader
s. A Java application is dynamically linked, which means that at runtime a ClassLoader
(which depends on the application) will link, load all libraries, or delegate loading. Static variables are called a class. If you try to access a static variable, the class' ClassLoader
will try to find and load the class. Since each application has its own ClassLoader
, each application has its own set of variables.
This is not like the principle of dividing the address space found in older languages. The application works in a separate address space, even if it is located on one computer. Therefore, two applications running side by side cannot simply access variables in another address space of the application, as this violates the restriction that is applied by several watchdogs. But be careful, the address space can be split explicitly.
source share