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

📄 scoreintosco.java

📁 java编写的桌面考试系统.含所有源码.
💻 JAVA
字号:
package exam.dao;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

public class ScoreIntoSco implements ScoreDao {
	public boolean addScore(int id, int score, String subject) {
		FileOutputStream fos = null;
		PrintWriter pw = null;

		try {
			fos = new FileOutputStream(new File(subject + ".sco"), true);
			pw = new PrintWriter(fos);

			pw.println(id + ":" + score);
			pw.flush();
			return true;
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		} finally {
			if (pw != null) {
				pw.close();
			}
			if (fos != null) {
				try {
					fos.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}

⌨️ 快捷键说明

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