Java program using arrays simple coding for project

后端 未结 2 1244
渐次进展
渐次进展 2021-01-29 16:02

I just want \"Jan Expenditure\" to appear however only expenditure comes out. How do I do it? Jan is from my monthsArrays. Is there anything missing?

import java         


        
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-29 16:22

    You have a typical +/-1 error in your code.

    Your monthsArray has an empty String at position 0 and you take the displayed String from month -1. Simply entering 2 and getting "Jan expenditure (max 10 items)" as a result should have been a good hint.

提交回复
热议问题