URLEncoder with sample program

Sample program:


package com.ngdeveloper.com;

import java.io.UnsupportedEncodingException;
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 {






URLEncoder Rules:

All the characters (a to z & A to Z) and numbers (0 to 9) remains same.

Space is converted to “+”

All the other characters are converted to hexadecimal values by prefixing with %.

In the above sample program, %40 is the hexadecimal value for @ sign.

Thanks for reading this post……………….!!!

992 total views, 2 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.