java中的非法转发引用 [英] illegal forward reference in java
本文介绍了java中的非法转发引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
import java.io.*;
import jxl.*;
class Xlparsing
{
Workbook wb =wb.getWorkbook(new File(
"C:\\Documents and Settings\\kmoorthi\\Desktop\\ak\\new.xls"));
// Illegal forward reference What it means
Sheet st = wb.getSheet(0);
Cell cell1 = st.getCell(0,0);
String a1 = cell1.getContents();
public static void main(String s[])
{
System.out.println(new Xlparsing().a1);
}
}
嗨当我试图从excel表中提取数据时非法转发引用错误来自文件对象创建。
Hi When I tried to extract data from excel sheet illegal forward reference error comes in the file object creation.
如何解决此问题?
推荐答案
非法转发引用表示您在定义变量之前尝试使用它。
"Illegal forward reference" means that you are trying to use a variable before it is defined.
在这种情况下,您试图在 wb
上的方法> wb 。
In this case, you are trying to invoke a method on wb
in the declaration of wb
.
Workbook wb = wb.getWorkbook(...);
这篇关于java中的非法转发引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文