The last post relative to reference and value
I hope that is true ...value type hold the value of the variable in the stack .... reference type hold just the pointer of the variable in the stack so when I say int x=5,y=x; both of them are stored on stack like that x=5 y=5; and when I change y value x will not be changed but when I say/write int[]x={1,2},y=x; the pointer x and y will be stored in stack and the array will be stored in heap x and y are pointing to the same address so when I change for example y[0]=0; x[0] will be changed also because x and y are pointing to the same address The point is here ...when I say String x="hellow",y=x; x and y will point to the same address on heap but when I say y="Hi"; x will not be changed because Strings are immutable the reference define is : the variable pointer is stored on the stack and the variable value is stored on heap . was that true ?😊 //in order to not misunderstand I am not trying //to advertise any thing I just want to learn truly thanks for help 😊💓