The Object Methods

The URLConnection class overrides only one method from java.lang.Object, toString( ):

public String toString(  )

Even so, there is little reason to print a URLConnection object or to convert one to a String, except perhaps for debugging. toString( ) is called the same way as every other toString( ) method.

Get Java Network Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.