📄 urlexam.java
字号:
import java.net.*;
import java.io.*;
public class urlExam {
public static void main(String args[]) {
String str;
try {
URL url = new URL("http://www.tsinghua.edu.cn/index.htm");
BufferedReader ins = new BufferedReader(new InputStreamReader(url.
openStream()));
while ( (str = ins.readLine()) != null) {
System.out.println(str);
}
}
catch (MalformedURLException e) {
System.out.println("URL错误,请重新输入");
}
catch (IOException e) {
System.out.println("输入信息时发生错误");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -