I have a doubt. Memory for static variable will be allotted at compile time. What if i write a class with 50000 static variables and compile that and never use that class. What about the memory allotted.Is it waste of memory?
The memory will be allotted when the class is *loaded* at runtime. A class that doesn't get used doesn't get loaded, so no, it wouldn't have any effect on memory consumption.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus