In Java, are static class members shared among programs?

前端 未结 7 2012
独厮守ぢ
独厮守ぢ 2020-12-15 19:38

I imagine that no, they aren\'t, because every process has its own memory space, of course.

But how does the whole JVM thing actually work? Is there

7条回答
  •  一向
    一向 (楼主)
    2020-12-15 20:36

    You are correct in your assumption. Yes, each JVM is a separate process. You can confirm this by opening Task Manager when you're running two Java programs (sort processes by name and look for java.exe or javaw.exe).

    It is possible to make JVMs connect to each other (with local sockets, for instance), but there's nothing built in.

提交回复
热议问题