getpage.java
来自「this gives details of the network progra」· Java 代码 · 共 29 行
JAVA
29 行
// Sample Java code - uses URL object to retreive a web page//// Looks for a url on the command line, sends the content of the// url to stdout.import java.net.*;import java.io.*;public class GetPage { public static void main(String[] args) throws IOException, MalformedURLException{ if (args.length!=1) { System.out.println("You need to specify a URL"); System.exit(0); } URL u = new URL(args[0]); // InputStream in = u.openStream(); BufferedReader r = new BufferedReader(new InputStreamReader ( u.openStream())); String s; while ( (s = r.readLine()) != null) { System.out.println(s); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?