Java URLDecoder sample program
Program:
[java]
package com.ngdeveloper.com;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
public class ComparePrintandSystem {
static String intro="I am naveen kumar working @ www.ngdeveloper.com";
public static void main(String[] args) throws UnsupportedEncodingException {
System.out.println("Input string is "+intro);
String encodedurl = URLEncoder.encode(intro,"UTF-8");
System.out.println("After encoding the INPUT " +encodedurl);
String decodedurl = URLDecoder.decode("After decoding the encoded input "+encodedurl,"UTF-8");
System.out.println(decodedurl);
}
}
[/java]
Output:
Input string is I am naveen kumar working @ www.ngdeveloper.com
After encoding the INPUT I+am+naveen+kumar+working+%40+www.ngdeveloper.com
After decoding the encoded input I am naveen kumar working @ www.ngdeveloper.com
Screenshot for your reference:
Thanks for reading this post…………..!!!