For example, let's suppose you want to use the URL
class in the java.net
package. By reading the
documentation for the class you discover that it has the following
public methods and constructors:
public URL(String protocol, String host, int port, String file)
throws MalformedURLException
public URL(String protocol, String host, String file)
throws MalformedURLException
public URL(String spec) throws MalformedURLException
public URL(URL context, String spec) throws MalformedURLException
public int getPort()
public String getFile()
public String getProtocol()
public String getHost()
public String getRef()
public boolean equals(Object obj)
public int hashCode()
public boolean sameFile(URL other)
public String toString()
public URLConnection openConnection() throws IOException
public final InputStream openStream() throws IOException
public static synchronized void
setURLStreamHandlerFactory(URLStreamHandlerFactory factory)
You use this class just like you'd use any other class with these
methods that happens to be named java.net.URL
.