synchronized void drop(Board board) {
int[][] a = getArray();
int[][] b = board.getArray();
//I don't have currentObject here... what do I need to write?
if (Board.goDown(currentX, currentY, b, a, board, currentObject)) {
currentY++;
updateXY();
}
}
The method call is currentObject.drop(board)
, but we can't pass in currentObject
as a variable.
Is there any easy way of doing this or I just have to rewrite the entire code?
You can use this keyword .
"this" is a reference to the current object.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.