Explain the difference between a URL instance and a URLConnection instance.URLConnection is a class under java.net package. The abstract class URLConnection is the superclass of all classes that represent a communications link between the application and a URL. Instances of this class can be used both to read from and to write to the resource referenced by the URL.
URL instance represents the location of the resources. URLConnection instance is used both to read from and to write to the resource referenced by the URL.