#Getting data from excel list and assign it to data members of object
23 messages · Page 1 of 1 (latest)
do you mind elaborating a little bit?
right now I have this?
or rather this was my approach
here are some errors in it
a for loop starting from a specific row and going through all its columns
do u know what is array
yeah
we can make it 2d too
and more dimensional too
like int[] will be 1 d int[][] will be 2d
so an array inside an array
okok
there are some errors but in the code
like u didnt put a variable name for first field
e inventory<>
the
oh yeah that ik
u can initiitate array normally like
int[] array = new int[100];
int[][] array = new int[100][20];
So you're iterating through the rows and columns which is okay, but you need to collect all the columns at once instead of looping through them. So the i loop is okay but the j loop might need to be conveyed into eight calls of getCell(2) through to (9)
That way you'll have all the values in one place and can create an object
Actually, you can also keep the loop and keep track of what j is so you assign the value to the right member. say if I==2, set desc, j==3, set bin etc