Consider the following program public class Foo public stati
Consider the following program. public class Foo {public static int x = 3; public int y; public Foo(){y - 10;} public char foo(char c){char d = c return d;} public static void main(String[] args){Foo t = new Foo (); f.loo(\'a\');}} When the program is run and line 8 has just finished executing, for each of the following state where the variable lives and where the data for the variable lives: f. d. c, x, y.
Solution
x is a static type variable (Class level variable ) it lives in Permgen area of Heap memory. and its value (x==3 )is stored in permGen area of heap memory.
y , d , c are local variables so the value and variable both are stored in thread stack area .
f is a refrennce to an object of class foo so it is stored in Heap memory
