/**
* @(#)b.java
*
*
* @author
* @version 1.00 2012/5/4
*/
import java.util.*;
import java.io.*;
import java.*;
public class b {
static void lireBddParcs(String nomFichier) throws IOException
{
LinkedHashMap parcMap = new LinkedHashMap<Parc,Collection<Manege>> ();
int n = 0;
boolean existeFichier = true;
FileReader fr = null;
try
{
fr = new FileReader (nomFichier);
}
catch(java.io.FileNotFoundException erreur)
{
System.out.println("Probleme rencontree a l'ouverture du fichier" + nomFichier);
existeFichier = false;
}
if (existeFichier)
{
BufferedReader entree = new BufferedReader(fr);
boolean finFichier = false;
while(!finFichier)
{
String[] line = entree.readLine().split("/t");;
Parc p = new Parc(line[0], line[1], line[2]);
if (line == null)
{
finFichier = true ;
}
else
{
parcMap.put(p, null);
}
}
entree.close();
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
lireBddParcs("parcs.txt");
}
}
テキストファイルの中身はこちら
Great America Chicago Illinois
Magic mountain Los Ageles Californie
Six Flags over Georgia Atlanta Georgie
Darien Lake Buffalo New York
La Ronde Montreal Quebec
The Great Escape Lake Georges New York
Six Flags New Orleans New Orleans Louisiane
Elitch Gardens Denver Colorado
Six Flags over Texas Arlington Texas
Six Flags New England Springfield Massachusetts
Six Flags America Washington D.C.
Great Adventure Jackson New Jersey
これが私が得ているエラーです:
error: unreported exception IOException; must be caught or declared to be thrown