Calling method on Document interface in Java
问题 I am trying to parse an XML file in Java and after getting the DocumentBuilder object, I call the parse method on it to get a Document object. e.g. Document dom = docbuild.parse(fileName); Then to get the root of the XML file, I use the method dom.getDocumentElement(); . Since Document is an interface as defined in the javadocs, how are we able to call a method on it without defining it first? My main objective is to create a class that inherits the Document interface, so I have to implement