当前位置: 技术问答>java相关
从一个txt文件中读信息,记录之间用回车符隔开,请帮我看看程序
来源: 互联网 发布时间:2015-11-16
本文导语: 我现在在用java写一段应用程序,从一个txt文件中读信息,记录之间用回车符隔开,现在问题是调试时老是找不到指定文件,再就是我对程序不满意,请大家提提修改意见,指出我的错误和不足之处。分数无上限。 publ...
我现在在用java写一段应用程序,从一个txt文件中读信息,记录之间用回车符隔开,现在问题是调试时老是找不到指定文件,再就是我对程序不满意,请大家提提修改意见,指出我的错误和不足之处。分数无上限。
public static void main(String[] args) {
String filepath = "d:temptest.txt";
try{
File readFrom = new File(filepath);
if(readFrom.exists()&&readFrom.isFile()&&readFrom.canRead()){
RandomAccessFile raf = new RandomAccessFile(readFrom,"r");
System.out.println("raf is created");
char c;
int i=0;
char[] charRead = new char[100];
char[] charNumber = new char[12];
char[] charPassword = new char[4];
char[] charDate = new char[10];
String Number = "";
String Password = "";
String strDate = "";
while(raf.getFilePointer()
public static void main(String[] args) {
String filepath = "d:temptest.txt";
try{
File readFrom = new File(filepath);
if(readFrom.exists()&&readFrom.isFile()&&readFrom.canRead()){
RandomAccessFile raf = new RandomAccessFile(readFrom,"r");
System.out.println("raf is created");
char c;
int i=0;
char[] charRead = new char[100];
char[] charNumber = new char[12];
char[] charPassword = new char[4];
char[] charDate = new char[10];
String Number = "";
String Password = "";
String strDate = "";
while(raf.getFilePointer()