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.w3schools.blog";
            String encodeURL=URLEncoder.encode( urlString, "UTF-8" );  
            System.out.println(encodeURL);
           } catch (Exception e) {
            e.printStackTrace();
          }
     }
}

Output

https%3A%2F%2Fw3spoint.com
Content Protection by DMCA.com
Please Share