本帖最后由 wangleixhlm 于 2014-5-30 18:22 编辑
- public class Something {
- public int addOne(final int x) {
- return ++x;
- }
- }
复制代码- public class Something {
- public static void main(String[] args)
- {
- Other o = new Other();
- new Something().addOne(o);
- }
- public void addOne(final Other o)
- {
- o.i++;
- }
- }
- class Other
- {
- public int i;
- }
复制代码
这两段代码有错吗?为什么? |
|