posted 7 years ago
I am studying a JSP book(JSP: Complete Reference by Hanna published by Osbourne) that includes sample code for a java class that one can use instead of a browser to display the server response to a request. The class name is WebClient. It has a main() method. It also has a constructor - public WebClient(String host, int port). The "main" method contains the following statement: new WebClient(host, port). Is this statement calling the constructor OR instantiating an inner class of the same name as the outer class OR what? If it is merely creating a new instance of the WebClient class, why would that be necessary? When one starts a java program with a mian method doesn't the constructor execute.