Please would you clarify me that? At the end the code works, but it's not clear how those interfaces (Sheet and WritableSheet) are working. While sheet was the previous implementation of what? Of an interface seems to me.Īnd which method they are using, if interfaces provide abstract method? No problem the first line, I create a new element, a label (that is a text cell) īut the second? again, addCell is a interface method seeing the api! Then in the sample code I arrive to this: Label lblNome = new Label(0, 1, "Nome:") While, then, using the createSheet method (provided by WritableWorkbook), it seems I'm creating a WritableSheet. But, I thought that I wasn't able to create an object from an interface. And "WritableSheet" is a subinterface of another interface, which is "Sheet".
The sheet is a "WritableSheet", but this is an interface! And seeing the api, there are no implementing classes. And until this, I'm there.īut, then, what am I doing in the second instruction? I'm creating the workbook using the static method provided by Workbook that is a superclass of WritableWorkbook. That is, the workbook object was previously instantiated and is a WritableWorkbook object. WritableSheet sheet = workbook.createSheet("first sheet", 0) So I was studying a sample code of jxl api, to write and read an excel file, and I arrived to this point: workbook = Workbook.createWorkbook(new File("/home/me/workspace/files/output.xls")) Well I know that an interface 'provides' only abstract methods to be implemented by the concrete subclasses. I'm quite new to Java and am stuck with this, please.