⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interface.java

📁 国外的数据结构与算法分析用书
💻 JAVA
字号:
package Interfaces;

import java.io.*;

/**	A general user interface. */
public class Interface
{
	/**	Get the user's login id number. */
	public int getLoginID()
	{
		System.out.print("Enter login ID (enter 0 to exit): ");
		return Integer.parseInt(readString());
	}
	
	/**	Get the password of the user. */
	public String getPassword()
	{
		System.out.print("Enter your password: ");
		return readString();
	}

	/**	Issue a message. */
	public void sendMessage(String message)
	{
		System.out.println(message);
	}

	/**	A buffered reader used to get console input. */
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	/**	A String read from the console. */
	public String readString()
	{
		String result = new String();
		try
		{
			result = br.readLine();
		} catch(IOException e) 
		{
			sendMessage("Could not read the current line.");
		}
		return result;
	}

	/**	Return 99 to indicate that there are no commands associated with the generic
		interface. */
	public int getCmdID()
	{
		return 99;
	}
}

⌨️ 快捷键说明

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