Alessandro Camel wrote:I found this tutorial
http://www.mkyong.com/java/how-to-read-xml-file-in-java-sax-parser/
but I can't really understand what is going on here:
I was expecting a ; after "new DefaultHandler()".
Why I find methods,and variables declarations ?
What am I missing ?
You are actually missing a ;
And a }
What you have actually got is
You have quoted the beginnings of an anonymous class. What you can do is take a class or interface and fill in methods or fields. You usually do it to abstract classes and interfaces, but you can do it to concrete classes too. You can add implement or override any methods. You can add fields. You can't add a constructor, but have to use the constructor from the superclass.
You can find out the details of the methods by looking up that class (or more probably interface) in the documentation:
here.
You now have an object of a class which implements/extends DefaultHandler, and any abstract methods have been fully implemented.
If you
search here, in
"Swing" and in
JiG for "anonymous class" you will find lots of other discussions about this question.