Hi all ..
can you help me to understand this ...
Suppose I've this program ..
class test
{
static int test1(int i)
{
return i++;
}
public static void main(String[] args)
{
int i=0;
int j=test1(i) + test1(i);
System.out.println(j);
}
}
now when I will compile it .. will it be loaded into the memory ?
What does parser do while compiling?
the out put is 0 .. j = 0+0 .. if this program , in statement
int j=test1(i) + test1(i); .. it will execute with left test1(i) and then the right test1(i) .. so when it will execute the left test1() will it not be saved into the memory so that when it is executed again it doesn't need to load it again to memory
what does jvm will do in this?
why the output is not like j=0+1 =1
can you plz explain in lucid way.
Thanks
Abhsihek