Answer the question
In order to leave comments, you need to log in
Why doesn't the compiler see newInstance()?
Good afternoon!
I'm trying to get a new DocumentBuilderFactory instance,
all required packages are specified,
but the compiler refuses to see the newInstance() method;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
public class Main {
public static void main() throws ParserConfigurationException {
DocumentBuilderFactory factory = new DocumentBuilderFactory.newInstance();
}
}
Answer the question
In order to leave comments, you need to log in
This is a static method, not a constructor. You don't have to new
put it in front of him.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question