how can I return array from function in java and retrieve value at the time of calling? -


i want make function returns array. function value excel sheet , store value in array. function return 2-d array when call it. when call function works fine. want value of return array store other 2-d array @ time of calling.

 public string[][] getvalue(string pathfile, string sheetname, int startrow) throws ioexception{         file excel= new file(pathfile);         fileinputstream fis = new fileinputstream(excel);         @suppresswarnings("resource")         xssfworkbook wb = new xssfworkbook(fis);           xssfsheet ws = wb.getsheet(sheetname);           int colnum = ws.getrow(startrow).getlastcellnum();           string [][] arrays = new string [1][colnum];           for(int i=0;i<=colnum;i++){                   xssfrow row= ws.getrow(startrow);                   xssfcell cell = row.getcell(i);                   arrays[0][i] = celltostring(cell);                   system.out.println(arrays[0][i]);           }           return arrays;       } 

my calling function code here - made string[][] data , put value calling function- data array didnot value calling function.

 string[][] data = getvalue("./src/dataexcel.xlsx","orgdata",2);     for(int i=0; i<data.length; i++){         // system.out.println(data.length);         string baseurl = data[0][1];         system.out.println(baseurl);         string fullname = data[0][2];         string email= data[0][3];         string password=data[0][4];         string orgname=data[0][5];     } 


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -