コードスニペットを以下に示します。私は次のエラーを取得するJavaは - 配列への参照
int[] cdb1 = {2,1,1,5,5};
int[] cbd2 = {3,1,1,2,2,6,6};
int[] cbd3 = {3,2,2,3,3,7,7};
int[] cbd4 = {2,3,3,4,4};
int[] cbd5 = {4,4,4,5,5,6,6,7,7};
String this_cdb = "cdb"+Integer.toString(router_id);
int this_cbd_number = this_cdb[0];
:必要な配列が、文字列が1
2
3
4
をすることができ ここrouter_id
int this_cbd_number = this_cdb[0];
を見つけましたか5
。私はthis_cdb
をString
と宣言しています。しかし、それを正しい配列名にどのように参照するのですか?
[router_id-1] right? – hnvasa
はい、あなたは正しいです、修正されました –