timeclient.java

来自「java3D game engine design of the source 」· Java 代码 · 共 28 行

JAVA
28
字号

// TimeClient.java
// Andrew Davison, June 2003, dandrew@ratree.psu.ac.th

/* Contact the TimeServlet running locally at 
   http://localhost:8080/servlet/TimeServlet
   and print its response.
*/

import java.net.*;
import java.io.*;


public class TimeClient 
{
   public static void main(String args[]) throws IOException
   {
     URL url  = new URL("http://localhost:8080/servlet/TimeServlet");
	 BufferedReader br = new BufferedReader(
              new InputStreamReader( url.openStream() ));	
     String line;
     while ( (line = br.readLine()) != null)
       System.out.println(line);
     br.close();                      
   }

} // end of TimeClient class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?