0

Can I be sure that

private int value;
public int getValue() { return value; }

is compiled by compiler in the same way as

public int Value;

in the terms of number of instructions and execution time? I mean do modern compilers trying to make functions "inline" (c++ term)?

4

1 回答 1

4

No; the Java compiler will not change that.

However, the JITter probably will.

于 2012-10-22T15:40:44.030 回答