URL的应用实例

import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.net.URL;
import
java.net.MalformedURLException;
public class URLReader{
    public static void main(String args[]){
        try{
            URL tirc = new
URL(“”);
            BufferedReader in = new
BufferedReader(new
                InputStreamReader(tirc.openStream()));
            String s;
            while((s =
in.readLine())澳门新葡亰游戏网址,!=null)
                System.out.println(s);
            in.close();    
        }catch(MalformedURLException
e) {
            System.out.println(e);    
        }catch(IOException e){
            System.out.println(e);
        }    
    }
}

 

import java.util.Scanner;
import java.net.URL;
import java.io.IOException;
import
java.net.MalformedURLException;
public class URLReader{
    public static void main(String args[]){
        try{
            URL tirc = new
URL(“”);
            Scanner scan = new
Scanner(tirc.openStream());
            while(scan.hasNext()){
                System.out.println(scan.next());
            }
        }catch(IOException e){
            System.out.println(e);
        }    
    }
}

网站地图xml地图