need of Static variables and their overhead on jvm

前端 未结 3 955
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-07 00:03

As per the concept about static members, they are created/loaded into the memory when there is first call made to its class. And they are common among all instances of that

3条回答
  •  萌比男神i
    2021-01-07 00:17

    1. No, they are collected with the class.

    2. Overhead compared to what? What's the alternative?

    3. Yes, but nobody said you have to fill them up with static members.

提交回复
热议问题