我想寫一個簡單的程序,讀取URL的前五行,然後以相反的順序打印出來,所以它應該是第5行4,3號線,2號線,1號線讀取URL的前5行,然後按相反順序打印
這裏就是我有這麼遠:
public static void main(String[] arg) throws Exception {
BufferedReader keyboard;
String inputLine;
keyboard = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Please enter the name of a company (without spaces): ");
System.out.flush(); /* Make sure the line is printed immediately. */
inputLine = keyboard.readLine();
URL u = new URL("http://www." + inputLine + ".com/");
InputStream ins = u.openStream();
InputStreamReader isr = new InputStreamReader(ins);
BufferedReader readURL = new BufferedReader(isr);
什麼是最優雅的方式做我想要做什麼?
你想幹什麼? 通常它包含html格式或java腳本或css,通常不會提供相關信息。 – 2011-03-29 14:00:26