import java.io.*;
import java.util.ArrayList;
public class geocoding {
public static ArrayList listGeoRegions= new ArrayList ();
public static void readGeoRegionFile(String fileName) throws FileNotFoundException{
File file = new File(fileName);
BufferedReader reader = null;
reader = new BufferedReader(new FileReader(file));
String tempString = null;
int line = 1;
System.out.println("line " + line + ": " + tempString);
line++;
listGeoRegions.add(tempString);
listGeoRegions.remove(listGeoRegions.get(0));
return;
}
public static void main(String[] args) throws FileNotFoundException {
readGeoRegionFile("e:\\geoRegion.txt");
}
}
这是什么问题 在线等大神!
------解决方案--------------------
public static ArrayList listGeoRegions = new ArrayList();
public static void readGeoRegionFile(String fileName) throws IOException {
File file = new File(fileName);
BufferedReader reader = null;
reader = new BufferedReader(new FileReader(file));
String tempString = null;
int line = 1;
while ((tempString = reader.readLine()) != null) {
System.out.println("line " + line + ": " + tempString);
line++;
listGeoRegions.add(tempString);
}
// listGeoRegions.remove(listGeoRegions.get(0));
return;
}
public static void main(String[] args) throws IOException {
readGeoRegionFile("d:\\time.txt");
}