Last Updated: June 6, 2026
A URL is a small string with a lot of structure inside it. https://shop.example.com:443/products/42?color=red#reviews is not one blob, it is six pieces glued together with separators, and any program that talks to the web needs to understand those pieces. Java's java.net.URL class is the standard way to parse and work with that structure. This lesson covers what a URL is at the spec level, how to construct a URL object from a string or its parts, how to read each component back out, the difference between URL and URI, and why URL.equals() quietly performs a DNS lookup that you almost never want.