Encode url in java

Encode url in java

package com.w3spoint;
 
import java.net.URLEncoder;
 
public class URLTest {
	public static void main(String args[]){
	   try {
            String urlString = "https://www.w3spoint.com";
            String encodeURL=URLEncoder.encode( urlString, "UTF-8" );  
            System.out.println(encodeURL);
           } catch (Exception e) {
            e.printStackTrace();
          }
     }
}

Output

https%3A%2F%2Fw3spoint.com
Please Share