Reputation: 1448
I Understand the concept of private static variables. However, I am concern with the memory use of my application.
Question 1: If I create private static members does it imply that they will last for the whole program execution and therefore wasting memory resources?
Question 2: Do private static members differ from public static members in terms of memory usage?
Question 3? What kind of memory they reside on? RAM memory?
Upvotes: 0
Views: 249
Reputation: 37023
Here's what you should be looking for:
Yes from the point when jvm will load your class till your JVM is up and running. You will have just one instance of you static member within whole JVM.
No. Here you are just differing the access specifier i.e. way one class could see the the static member of your class from another class.
Yes they are on RAM.
Upvotes: 2