This is the code I used :
class ResponseCodeCheck
{
public static void main (String args[]) throws Exception
{
URL url = new URL("http://www.amazon.co.jp/gp/seller/sell-your-stuff.html");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
int code = connection.getResponseCode();
System.out.println("Response code of the object is "+code);
if (code==200)
{
System.out.println("OK");
}
}
}
And it gave 404 for the URL while that URL is working fine. Any reason why ?