int a = 1;
int b = 1;
How many JVM operations you see in the following code?
int c = a + b;
The answer is 4 :
iload_0
iload_1
iadd
istore_2The JVM will load a and b (index 0 and 1 of the local variable array), add them together (in the operand stack), and will assign the result to c (index 2 of the local variable array).
No comments:
Post a Comment