java 对象赋值

功能:将cell放置在field[][]中

public Cell place(int row, int col, Cell o) {
//初始时ret 和field[][]都指向null
field[row][col]=o;
//field[][] 指向o对象
//此处ret仍为null
Cell ret=field[row][col];
return ret;
}

//实际并未将cell放置在field中,field[][]仍为空
// public Cell place(int row,int col ,Cell o)
// {
//初始时ret 和field[][]都指向null
// Cell ret=field[row][col];
// ret指向o
//field[][] 仍为空
// ret=o;
// return ret;
// }

原文地址:https://www.cnblogs.com/tianxiaoxiao/p/7512335.html