File src = new File(filePath);
FileInputStream fis = new FileInputStream(src);
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sheet1 = wb.getSheetAt(0);
Why did they pass the src object to FileInputStream?
Why did they pass FileInputStream object to xssfworkbook?
Why they did'nt pass any objects for xssfsheet?
Why did they pass the src object to FileInputStream?
Because FileInputStream
will need a File
to instantiate. src
is an instance of File
.
Why did they pass FileInputStream object to xssfworkbook?
Because XSSFWorkbook
needs a FileInputStream
to instantiate. fis is a FileInputStream
.
Why they did'nt pass any objects for xssfsheet?
Because the sheet can be retrieved from wb
using getSheetAt
.