fileopen.java

来自「学生信息管理系统」· Java 代码 · 共 55 行

JAVA
55
字号
/*
 * FileOpen.java
 *
 * Created on 2008年4月5日, 下午8:17
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package finaltest;
import java.io.*;
/**
 *
 * @author Administrator
 */
public class FileOpen {
    static FileOpen flieopen;
    /** Creates a new instance of FileOpen */
    public FileOpen() throws FileNotFoundException, IOException {
        String tempstr =null;
        StudentNode.head =new StudentNode();
        StudentNode temp =StudentNode.head;
        StudentNode temp2 =null; 
        
        BufferedReader bufin =new BufferedReader(new FileReader("fei.txt"));
        while(true){
            if((tempstr = bufin.readLine())!=null){
                String stu[] =tempstr.split("#");
                temp.student =new Student();
                temp.student.setId(stu[0]);
                temp.student.setName(stu[1]);
                temp.student.setAge(Integer.valueOf(stu[2]));
                temp.student.setSex(stu[3]);
                temp.student.setMajor(stu[4]);
                temp.student.setMyclass(stu[5]);
            
                StudentNode.rear =temp;
                
                temp2 =new StudentNode();
                temp.next =temp2;
                temp2.prev =temp;
                temp =temp.next;
            }else{
                 temp.prev =null;
                 StudentNode.rear.next =null;
                 break;
            }
            
        }
        bufin.close();
    }
    
  
}

⌨️ 快捷键说明

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