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

📄 find.java

📁 上次小组练习做的一个学生信息管理小系统 控制台的
💻 JAVA
字号:
package system;

import java.io.*;
import java.util.*;

public class Find {

	public long numberTokenizer(String s) throws IOException {
		StringTokenizer st = new StringTokenizer(s, " ");
		return Integer.valueOf((st.nextToken())).longValue();
	}

	// 查找数据
	public void findData(long find) throws IOException, NumberNotFoundException {

		String s = "", findString = "";
		long i;
		DataMap dm = new DataMap();
		BufferedReader in = new BufferedReader(new FileReader("d:\\data.txt"));
		while ((s = in.readLine()) != null) {
			i = numberTokenizer(s);
			dm.put(i, s);
		}

		try {
			if (dm.containsKey(String.valueOf(find).toString())) {
				findString = dm.get(find);
				System.out.println("学号" + find + "学生的资料是:");
				System.out.println(findString);
			} else
				throw new NumberNotFoundException();
		} catch (NumberNotFoundException e) {
			System.out.println(find + " no found :(");

		}
	}
}

 class NumberNotFoundException extends Exception {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public NumberNotFoundException() {
		System.out.println("您输入错误!");
	}
}

⌨️ 快捷键说明

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