今天在解析xml文件的时候,创建处理器对象的时候(处理器对象继承了DefaultHandler)出现了错误,如图:
No enclosing instance of type XmlTest is accessible. Must qualify the alloca

我很好奇,明明下面有在创建这个类,为什么创建不出呢,看下错误,提示为No enclosing instance of type XmlTest is accessible. Must qualify the alloca,通过百度,终于找到解决办法,就是在要创建对象的那个类中加上static,将其设置为静态的,而后就可以创建对象了,具体原有也不是很清楚,好像是main方法是静态的·,不能创建非静态的实例。

相关文章:

  • 2021-08-15
  • 2021-09-08
  • 2022-12-23
  • 2021-08-05
  • 2022-02-03
  • 2022-12-23
  • 2022-01-01
猜你喜欢
  • 2021-06-02
  • 2021-07-24
  • 2021-05-24
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2021-11-17
相关资源
相似解决方案