No enclosing instance of type XmlTest is accessible. Must qualify the alloca

今天在解析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方法是静态的·,不能创建非静态的实例。