1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
String[] monArray;
try
{
Path filePath = new File("e:\\conversiontramemetre2.csv").toPath();
Charset charset = Charset.defaultCharset();
List<String> stringList = Files.readAllLines(filePath, charset);
//String[] stringArray = stringList.toArray(new String[]{});
for (int i = 0; i < stringList.size(); i++)
{
System.out.println(stringList.get(i));
}
// Je souhaite copier stringList dans monArray (variable globale) pour etre reutilise ailleurs
} catch (Exception e)
{
e.printStackTrace();
System.out.println(e.toString());
}
System.out.println("Chargement du fichier monfichier.txt termine !"); |
Partager