0
在lamba體中,是否可以使用既不是最終也不是最終的變量?
那麼有沒有辦法讓下面的代碼編譯?是否有可能在lambda體或匿名類中使用不是有效的final或final變量?
class Main {
interface Test{
String method();
}
void w(){
String str = "foo";
str = "bar";
Test t =() -> str;
}
}
不可能用';'str after後:) – user43968
謝謝,我會改變:) – user7153839