Skip to Main Content

parser/compiler/jvm

User_4NU9SOct 15 2013 — edited Oct 17 2013

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

This post has been answered by unknown-7404 on Oct 15 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Nov 14 2013
Added on Oct 15 2013
3 comments
1,760 views