+ 3
I'm trying to learn how to read/write a file in java
Anyone who could give me a basic exemple of how to read a double and write it to another file? I'm a bit stuck
1 Odpowiedź
+ 1
try (BufferedReader br=Files.newBufferedReader (Paths.get ("your path");BufferedWriter bw=Files.newBufferedWriter (Paths.get("your other path"))){String in=br.readLine ();
int i=Integer.parseInt (in);
//do stuff
bw.write (Integer.toString (i));
}catch (IoException|NumberformatException e){
//error handling
}