This tutorial will teach you how to test Url.defined in the URL class to retrieve information about the URL.
public class URLTest { public static void main(String[] args) { URL obj; try { obj = new URL("https://www.tutussfunny.com"); System.out.println("Protocal : " + obj.getProtocol() ); System.out.println("host : " + obj.getHost() ); System.out.println("Port : " + obj.getPort()); } catch (MalformedURLException ex) { Logger.getLogger(URLTest.class.getName()).log(Level.SEVERE, null, ex); } }
I have attached the video tutorial below it will help you to do this step by step.