我正在尝试访问父类中的子类变量。你能建议我如何根据下面的代码片段进行操作吗?
public abstract class Base{
//some abstract methods
//one more method to parse the xml
public final void parseXml(){
String clName = Thread.currentThread().getStackTrace()[1].getClassName(); //child class name
if(xmlFile_+clName){ //i am trying to access "Test.xmlFile_Test",
//execute the if string is available
}
}
}
public class Test extends Base{
public static final String xmlFile_Test = "<Hello>sample</Hello>";
public int execute(){
parseXml(); //This should call base class method
}
}
我的错误步骤在哪里..这是伪代码,可能会帮助您回答