أم تـــاله
17-11-2007, 02:49 AM
هذا كود برنامج بلغه الجافا موجود الرن يعني output بس ان مو فاهمه البرنامج
يعني مو فاهمه كل سطر في البرنامج اش يسوي؟؟؟
// UCDemo.java Demonstrate URLConnection.
import java.net.*;
import java.io.*;
import java.util.Date;
class UCDemo
**
public static void main(String args[]) throws Exception **
int c;
URL hp = new URL("http://fox.bridgeport.edu");
URLConnection hpCon = hp.openConnection();
System.out.println("Date: " + new Date(hpCon.getDate()));
System.out.println("Content-Type: " + hpCon.getContentType());
System.out.println("Expires: " + hpCon.getExpiration());
System.out.println("Last-Modified: " +
new Date(hpCon.getLastModified()));
int len = hpCon.getContentLength();
System.out.println("Content-Length: " + len);
if (len > 0) **
System.out.println("=== Content ===");
InputStream input = hpCon.getInputStream();
int i = len;
while (((c = input.read()) != -1) && (--i > 0)) **
System.out.print((char) c);
}
input.close();
} else **
System.out.println("No Content Available");
}
}
}
Write your output here:
Date: Thu Jan 01 03:00:00 AST 1970
Content-Type: text/html; charset=utf-8
Expires: 0
Last-Modified: Thu Jan 01 03:00:00 AST 1970
Content-Length: 732
=== Content ===
Exception in thread "main" java.io.IOException: Server returned HTTP response co
de: 503 for URL: http://fox.bridgeport.edu
at sun.net.www.protocol.http.HttpURLConnection.getInp utStream(HttpURLCon
nection.java:691)
at sun.net.www.protocol.http.HttpURLConnection.getHea derField(HttpURLCon
nection.java:1116)
at java.net.HttpURLConnection.getHeaderFieldDate(Http URLConnection.java:
245)
at java.net.URLConnection.getDate(URLConnection.java: 416)
at UCDemo.main(UCDemo.java:12)
Press any key to continue.
رجو الرد علي ::::
يعني مو فاهمه كل سطر في البرنامج اش يسوي؟؟؟
// UCDemo.java Demonstrate URLConnection.
import java.net.*;
import java.io.*;
import java.util.Date;
class UCDemo
**
public static void main(String args[]) throws Exception **
int c;
URL hp = new URL("http://fox.bridgeport.edu");
URLConnection hpCon = hp.openConnection();
System.out.println("Date: " + new Date(hpCon.getDate()));
System.out.println("Content-Type: " + hpCon.getContentType());
System.out.println("Expires: " + hpCon.getExpiration());
System.out.println("Last-Modified: " +
new Date(hpCon.getLastModified()));
int len = hpCon.getContentLength();
System.out.println("Content-Length: " + len);
if (len > 0) **
System.out.println("=== Content ===");
InputStream input = hpCon.getInputStream();
int i = len;
while (((c = input.read()) != -1) && (--i > 0)) **
System.out.print((char) c);
}
input.close();
} else **
System.out.println("No Content Available");
}
}
}
Write your output here:
Date: Thu Jan 01 03:00:00 AST 1970
Content-Type: text/html; charset=utf-8
Expires: 0
Last-Modified: Thu Jan 01 03:00:00 AST 1970
Content-Length: 732
=== Content ===
Exception in thread "main" java.io.IOException: Server returned HTTP response co
de: 503 for URL: http://fox.bridgeport.edu
at sun.net.www.protocol.http.HttpURLConnection.getInp utStream(HttpURLCon
nection.java:691)
at sun.net.www.protocol.http.HttpURLConnection.getHea derField(HttpURLCon
nection.java:1116)
at java.net.HttpURLConnection.getHeaderFieldDate(Http URLConnection.java:
245)
at java.net.URLConnection.getDate(URLConnection.java: 416)
at UCDemo.main(UCDemo.java:12)
Press any key to continue.
رجو الرد علي ::::