📄 daytimeclient1.java
字号:
import java.io.*;
/**
* This module contains the presentaton logic of a DaytimeClient.
* @author M. L. Liu
*/
public class DaytimeClient1 {
public static void main(String[] args) {
InputStreamReader is = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(is);
try {
System.out.println("Welcome to the Daytime client.\n" +
"What is the name of the server host?");
String hostName = br.readLine();
if (hostName.length() == 0) // if user did not enter a name
hostName = "localhost"; // use the default host name
System.out.println("What is the port number of the server host?");
String portNum = br.readLine();
if (portNum.length() == 0)
portNum = "13"; // default port number
System.out.println("Here is the timestamp received from the server"
+ DaytimeClientHelper1.getTimestamp(hostName, portNum));
} // end try
catch (Exception ex) {
ex.printStackTrace( );
} // end catch
} //end main
} // end class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -