URL is an acronym for Uniform Resource Locator. It refers to a resource on the World Wide Web.
URL example:
https://826.a00.myftpupload.com |
The java.net.URL class is used to represent an URL.
Create url object in java
package com.w3spoint; import java.net.MalformedURLException; import java.net.URL; public class URLTest { public static void main(String args[]){ try { String myUrl = "https://www.w3schools.blog"; URL url = new URL(myUrl); System.out.println(url.toString()); } catch (MalformedURLException e) { e.printStackTrace(); } } } |
Output
https://826.a00.myftpupload.com |