Where are static variables stored? As I know in java 7 it was PermGen. But java 8 migrated to MetaSpace. So are they stored in MetaSpace or is there another location?
Static methods and variables have been Stored in the PERMGEN space before the 8th version of the java. But,now they have introduced a new memory space called METASPACE now this is the place where all those name and fields of the class, methods of a class with the bytecode of the methods, constant pool, JIT optimizations etc are stored. Reason for removing PERMGEN in java 8.0 is It is very hard to predict the required size of PERMGEN.. It helps in improving Garbage Collection Performance and Class data-de allocation..
Ref: https://www.quora.com/Where-static-method-and-variables-stored-in-JVM