i used a cvs file to save the data and then i turned the data in to arrays sbut i cant use it.
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.*;
import java.util.Scanner;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
class gee {
public static void main(String[] args) throws IOException{
Scanner reader = new Scanner (System.in);
String quemical = reader.nextLine();
String path = "C:/Users/sebas/OneDrive/Escritorio/variablesdff.csv.txt";
String line ="";
try {
BufferedReader br = new BufferedReader(new FileReader(path) );
while ((line=br.readLine())!=null) {
String[] values = line.split(",");
System.out.println("chemicals:" + values[0] + "=" + values[1]);
}
} catch (FileNotFoundException e){
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
}
}[it is able to get the data from the textfile but i cant use it eventhough it is saved in the array. i need to used this data for later comapare it whith the data of the user ][1]
so this is the code im using to create my program. it works, but as ai said before, the only thing is that i cant use the values of the arrays [1]: https://i.stack.imgur.com/c6p0b.png
Aucun commentaire:
Enregistrer un commentaire