ArrayIndexOutOfBounds on enhanced for loop

前端 未结 2 748
囚心锁ツ
囚心锁ツ 2021-01-28 03:59

I am trying to figure out part of an assignment and I have been beating my head against a wall for some time now. I\'m trying to transcribe DNA sequences to RNA sequences. I am,

2条回答
  •  既然无缘
    2021-01-28 04:36

    You want 1 less than size , so : if (pos1 >= linkedList.size()) {.

    When pos1 == linkedList.size() it will be out of bounds

提交回复
热议问题