package com.json;
import java.net.URLEncoder;
public class HttpTest {
static String RELATE_COURSE_URL = "http://course.aabb.net/courseinfo/countRelateCourse?courseName=%s&b=%s";
public static void main(String[] args) {
String url = String.format(HttpTest.RELATE_COURSE_URL, URLEncoder.encode("a"), URLEncoder.encode("men"));System.out.println(url);}} 结果:http://course.aabb.net/courseinfo/countRelateCourse?courseName=a&b=men//URLEncoder.encode:处理中文用的