import java.io.*;
import jxl.*;
class Xlparsing
{
Workbook wb =wb.getWorkbook(new File(
\"C:\\\\Documents and Settings\\\\kmoorthi\\\\Desktop\\\\ak\\\\new
although getWorkbook is static, so accordingly, this code should have worked. But here, using the reference before its declaration or in the same statement as declaration is causing error "Forward referencing i.e. using reference before declaration".
I guess that the intention was to call 'statically' the getWorkbook()
method, as you should. So, you should change your wb
member initialization as:
Workbook wb = Workbook.getWorkbook(...)
"Illegal forward reference" means that you are trying to use a variable before it is defined.
In this case, you are trying to invoke a method on wb
in the declaration of wb
.
Workbook wb = wb.getWorkbook(...);
Forward Illegal Reference is a term which comes into picture when an uninitialized non global variable value is assigned to a global variable.
In your case Workbook wb = wb.getWorkbook(new File("----"));
- wb
is uninitialized before calling the getWorkbook()
method. For avoiding the FIR you should initialize wb
.