我正在尝试从与创建列表的类不同的类中调用函数列表。我是说
public class FUNCTION {
String fichier=null;
int nb_link_func=-1;
String fonc_nom=null;
int [] list_id=null;
public FUNCTION() {
};
};
/////////////
public class CODE {
FUNCTION [] fonctions;
public CODE (String tree_file) {
// I fill the variable list_id up, the list of functions
};
}
/////////////
public class Tree extends JTree {
CODE code=null;
private JTree tree;
String fname=null;
public Tree (String tree_file,DefaultMutableTreeNode top) {
super(top);
code=new CODE(tree_file);
fname=fonctions[1].getNom(); //This returns cannot find symbol fonctions
};
};
它返回“找不到符号功能”出了点问题,但我找不到
首先通过以下方式公开功能:
public FUNCTION [] fonctions;
并更改:
fname=fonctions[1].getNom();
至:
fname=code.fonctions[1].getNom();
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句