Where java static variables are stored in memory?

Deepak picture Deepak · Mar 29, 2014 · Viewed 25.1k times · Source
class A{
 static int i = 10;
 static int j = 20;

 static void getname(){

   }

}

Where will these variable be stored in memory ?

Answer

user2873260 picture user2873260 · Mar 29, 2014

simply said , Static Variables are stored in HEAP. Classes and all of the data applying to classes (not instance data) is stored in the Permanent Generation section of the heap.

If you need elaborated answer , refer this

static allocation in java - heap, stack and permanent generation