Below is a simple code to access all the cells of an excel sheet. I didn't use the classes XSSFWorkbook, XSSFSheet...etc My confusion is if an interface only holds signature of the methods then how come I'm able to use methods like getRow, getCell using interfaces?
(where are those methods defined that are listed when I type sheet and then type period)
Thanks in advance.
FileInputStream inputStream = new FileInputStream("C:\\Eclipse\\WorkSpace\\YPractice\\TestCase.xlsx");
Workbook guru99Workbook = null;
guru99Workbook = new XSSFWorkbook(inputStream);
Sheet sheet = guru99Workbook.getSheet("KeywordFramework");
int RowNum = sheet.getLastRowNum() - sheet.getFirstRowNum();
for (int i = 0; i<=RowNum; i++)
{
Row row = sheet.getRow(i);
for(int j= 0; j<row.getLastCellNum(); j++)
{
System.out.println("Data = " +i + " " +row.getCell(j));
}
}