java - How I can index the array starting from 1 instead of zero? -


for (int = 0; < reports.length; i++) {    products[] products = reports[i].getdecisions;    (int j = 0; j < products.length; j++) {    } } 

here want index inner loop starting 1 , not working expected, changed j

java arrays 0-based. can't change behavior. can fill or use index, can't change base index.

it's defined in jls §10.4, if interested in.

a component of array accessed array access expression (§15.13) consists of expression value array reference followed indexing expression enclosed [ , ], in a[i].

all arrays 0-origin. array length n can indexed integers 0 n-1.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -