0
メソッドにブール値の配列を渡そうとしています。このコードは動作します:Javaのメソッドに引数として新しい配列を渡すには?
void checkResults(boolean[] isChecked){
//Do something
}
boolean[] isChecked= {true, true};
checkResults(isChecked); //works
しかし、以下のすべての試みが失敗しました:
checkResults(new {true, true}); //Compile time error
checkResults({true, true}); //Compile time error
checkResults(true, true); //Compile time error (this one is obvious)
は、引数の配列を作成し、1行でメソッドに渡す方法はありますか?
'checkResults(new boolean [] {true、true})'を試したことがありますか? – VatsalSura