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

📄 shoumingfile.java

📁 长沙公交查询管理系统,主要实现对人员资料的管理以及车辆的分配路线。
💻 JAVA
字号:
/*这是负责读说明文件的类*/
package pro;
import java.io.*;
public class ShouMingFile
{
	public ShouMingFile()
	{
	}
	public String wenJian()
	{
		String str="";
			      try {
			      File file = new File("shuoming.txt"); 
			      FileInputStream fis = new FileInputStream(file);
			      byte[] buf = new byte[(int)(file.length())];
			      fis.read(buf);  
			      str = new String(buf);  
			     
			     // jtxt.setText(str);
			      fis.close();     
	          } 
	          catch (FileNotFoundException fnfe)
	          {
	          System.out.println("文件打开失败。");
	          }
	          catch (IOException ioe) 
	          {
	          ioe.printStackTrace();
	          }
	          return str;
	}
	
	
	
	public String wenJianTianQi()//读天气文件的方法
	{
		String str="";
			      try {
			      File file = new File("tianqi.txt"); 
			      FileInputStream fis = new FileInputStream(file);
			      byte[] buf = new byte[(int)(file.length())];
			      fis.read(buf);  
			      str = new String(buf);  
			     
			     // jtxt.setText(str);
			      fis.close();     
	          } 
	          catch (FileNotFoundException fnfe)
	          {
	          System.out.println("文件打开失败。");
	          }
	          catch (IOException ioe) 
	          {
	          ioe.printStackTrace();
	          }
	          return str;
	}
	
}

⌨️ 快捷键说明

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