我想通過將方法傳遞給方法set_Execute.Can來設置一個布爾值爲true。有人可以幫助解決這個問題嗎?無法通過在方法內調用變量來將值設置爲
這裏是代碼:
public boolean canExecute(){
boolean execute=false;
set_Execute(execute);
log("can execute"+execute); //it is going inside method set_Execute but it is always printing execute as false
return execute;
}
private boolean set_Execute(boolean setExecute){
return setExecute=true;
}
@ ritesht93這絕對沒有區別。 '布爾'是不可變的。 – Radiodef
不,我通過那個帖子,但沒有得到確切的答覆,並且它說abt傳遞參考或value.mine是不同的 – divya
它不是。完全一樣。 – Savior